Messages to Trackbars

An application can send messages to the trackbar to retrieve information about the window and to change its characteristics.

To retrieve the position of the slider (that is, the value the user has chosen), use the TBM_GETPOS message. To set the position of the slider, use the TBM_SETPOS message.

The range of a trackbar is the set of contiguous values that the trackbar can represent. Most applications use the TBM_SETRANGE message to set the range of a trackbar when it is first created. Applications can dynamically alter the range after the trackbar has been created by using the TBM_SETRANGEMAX and TBM_SETRANGEMIN messages. An application that allows the range to be changed dynamically typically retrieves the final range settings when the user has finished working with the trackbar. To retrieve these settings, use the TBM_GETRANGEMAX and TBM_GETRANGEMIN messages.

An application can use the TBS_AUTOTICKS style to have a trackbar's tick marks displayed automatically. If an application needs to control the position or frequency of the tick marks, however, a number of messages can be used. To set the position of a tick mark, an application can use the TBM_SETTIC message. The TBM_SETTICFREQ message allows an application to set tick marks that appear at regular intervals in the trackbar's range. For example, the application can use this message to display only ten tick marks in a range of 1 through 100. To retrieve the index in the range corresponding to a tick mark, use the TBM_GETTIC message. The TBM_GETPTICS message retrieves an array of these indices. To retrieve the position of a tick mark, in client coordinates, use the TBM_GETTICPOS message. An application can retrieve the number of tick marks by using the TBM_GETNUMTICS message. The TBM_CLEARTICS message removes all of a trackbar's tick marks.

A trackbar's line size determines how far the slider moves when an application receives a TB_LINEDOWN or TB_LINEUP notification message. Similarly, the page size determines the response to the TB_PAGEDOWN and TB_PAGEUP notification messages. Applications can retrieve and set the line and page size values by using the TBM_GETLINESIZE, TBM_SETLINESIZE, TBM_GETPAGESIZE, and TBM_SETPAGESIZE messages.

An application can use messages to retrieve the dimensions of a trackbar. The TBM_GETTHUMBRECT message retrieves the bounding rectangle for the slider. The TBM_GETCHANNELRECT message retrieves the bounding rectangle for the trackbar's channel. (The channel is the area over which the slider moves and which contains the highlight when a range is selected.)

If a trackbar has the TBS_ENABLESELRANGE style, the user can select a range of contiguous values from it. A number of messages allow the selection range to be adjusted dynamically. The TBM_SETSEL message sets the starting and ending positions of a selection. To set just the starting position or just the ending position of a selection, use the TBM_SETSELSTART or TBM_SETSELEND message. When the user has finished setting a selection range, an application can retrieve the settings by using the TBM_GETSELSTART and TBM_GETSELEND messages. To clear a user's selection, use the TBM_CLEARSEL message.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database