Table 2-2 lists the messages that can be sent to trackbars and the corresponding member functions supported by the MFC-supplied class CSliderCtrl. You can find detailed information about the parameters and return values in the Win32 SDK and the MFC 3.1 documentation.
Message | Member Function | Description |
TBM_CLEARSEL | ClearSel | Clears the current selection range in a trackbar. |
TBM_CLEARTICS | ClearTics | Removes the tick marks from a trackbar. |
TBM_GETCHANNELRECT | GetChannelRect | Retrieves the rectangle bounding the channel in which the slider slides. |
TBM_GETLINESIZE | GetLineSize | Retrieves the amount the slider will move when the user presses the Up or Down arrow key (or the Left or Right arrow key for a horizontal trackbar). The default increment is one tick. |
TBM_GETNUMTICS | GetNumTics | Retrieves the number of tick marks in a trackbar. |
TBM_GETPAGESIZE | GetPageSize | Retrieves the amount the slider will move when the user presses the PgUp or PgDn key. The default is calculated as the difference between the maximum and the minimum of the range divided by 5. |
TBM_GETPOS | GetPos | Retrieves the current position of the slider. |
TBM_GETPTICS | GetTicArray | Retrieves the address of the array containing the positions of the tick marks in a trackbar. |
TBM_GETRANGEMIN and TBM_GETRANGEMAX | GetRange | Retrieves the current range (the minimum and maximum positions) for the slider. |
Table 2-2. (continued)
Trackbar messages and member functions.
Message | Member Function | Description |
TBM_GETRANGEMAX | GetRangeMax | Retrieves the maximum position for the slider. |
TBM_GETRANGEMIN | GetRangeMin | Retrieves the minimum position for the slider. |
TBM_GETSELSTART and TBM_GETSELEND | GetSelection | Retrieves the current selection range in a trackbar. |
TBM_GETSELEND | GetSelEnd | Retrieves the ending position of the current selection range in a trackbar. |
TBM_GETSELSTART | GetSelStart | Retrieves the starting position of the current selection range in a trackbar. |
TBM_GETTHUMBLENGTH | Retrieves the length of the slider. | |
TBM_GETTHUMBRECT | GetThumbRect | Retrieves the rectangle bounding the slider. |
TBM_GETTIC | GetTic | Retrieves the position of a tick mark. |
TBM_GETTICPOS | GetTicPos | Retrieves the position, in client coordinates, of a tick mark. |
TBM_SETLINESIZE | SetLineSize | Sets the amount the slider will move when the user presses the Up or Down arrow key (or the Left or Right arrow key for a horizontal trackbar). The default increment is one tick. |
TBM_SETPAGESIZE | SetPageSize | Sets the amount the slider will move when the user presses the PgUp or PgDn key. The default is calculated as the difference between the maximum and the minimum of the range divided by 5. |
TBM_SETPOS | SetPos | Sets the current position of the slider. |
TBM_SETRANGE | SetRange | Sets the minimum and maximum positions for the slider. |
TBM_SETRANGEMAX | SetRangeMax | Sets the maximum position for the slider. |
TBM_SETRANGEMIN | SetRangeMin | Sets the minimum position for the slider. |
TBM_SETSEL | SetSelection | Sets the starting and ending positions of the selection range in a trackbar. |
TBM_SETSELEND | Sets the position of the end of the selection range in a trackbar. | |
TBM_SETSELSTART | Sets the starting position of the current selection range in a trackbar. | |
TBM_SETTHUMBLENGTH | Sets the length of the slider. | |
TBM_SETTIC | SetTic | Sets the position of a tick mark. |
TBM_SETTICFREQ | SetTicFreq | Sets the tick frequency. |
VerifyPos | Verifies that the current position of the slider is within the trackbar range. |
NOTE: Table 2-2 describes many messages that support trackbar ranges and positions. Although trackbars are based on scroll bars, it is important to note that a trackbar updates its position automatically. In the case of a scroll bar, it is up to the application to update the scroll bar position when the WM_HSCROLL message or the WM_VSCROLL message is received.