Track Bar control help

Function help:

Real API_Trackbar_Create (Real Parent Handle, Real X, Real Y, Real Width, Real Height, Real Style Flags, Real Extended Style Flags);

This function creates a new trackbar control.

Argument list:
(0) Parent Handle: Identifies the window handle of the window to create this control on.
(1) X: The horizontal position of the control in pixels, relative to the parent window.
(2) Y: The vertical position of the control in pixels, relative to the parent window.
(3) Width: The horizontal size of the control in pixels.
(4) Height: The vertical size of the control in pixels.
(5) Style Flags: The style flags, supports the Global Control Styles and the following styles:

TBS_AUTOTICKS
The trackbar control has a tick mark for each increment in its range of values.

TBS_VERT
The trackbar control is oriented vertically.

TBS_HORZ
The trackbar control is oriented horizontally. This is the default orientation.

TBS_TOP
The trackbar control displays tick marks above the control. This style is valid only with TBS_HORZ.

TBS_BOTTOM
The trackbar control displays tick marks below the control. This style is valid only with TBS_HORZ.

TBS_LEFT
The trackbar control displays tick marks to the left of the control. This style is valid only with TBS_VERT.

TBS_RIGHT
The trackbar control displays tick marks to the right of the control. This style is valid only with TBS_VERT.

TBS_BOTH
The trackbar control displays tick marks on both sides of the control. This will be both top and bottom when used with TBS_HORZ or both left and right if used with TBS_VERT.

TBS_NOTICKS
The trackbar control does not display any tick marks.

TBS_ENABLESELRANGE
The trackbar control displays a selection range only. The tick marks at the starting and ending positions of a selection range are displayed as triangles (instead of vertical dashes), and the selection range is highlighted.

TBS_NOTHUMB
The trackbar control does not display a slider.

TBS_REVERSED
This style bit is used for "reversed" trackbars, where a smaller number indicates "higher" and a larger number indicates "lower." It has no effect on the control; it is simply a label that can be checked to determine whether a trackbar is normal or reversed.

TBS_DOWNISLEFT
By default, the trackbar control uses down equal to right and up equal to left. Use the TBS_DOWNISLEFT style to reverse the default, making down equal left and up equal right.

Style flags can be separated by a bitwise or '|' operator.

(6) Extended Style Flags: This can be any combination of the Global Extended Control Styles.

Return value:
If this function succeeds, it returns the Control ID of the control, otherwise it returns 0.


Real API_Trackbar_GetPos ( Real Control ID)

Gets the current logical position of the slider in a trackbar.

Return value:
Returns the posititon.
Real API_Trackbar_GetNumTics ( Real Control ID )

Returns the number of tics inside a trackbar control.

Return value:
Returns the number of tics.
Real API_Trackbar_GetRangeMax ( Real Control ID)

This function returns the the maximum position in the trackbar's range.

Return value:
Returns the the maximum position in the trackbar's range.
Real API_Trackbar_GetRangeMin ( Real Control ID)

This function returns the the minimum position in the trackbar's range.

Return value:
Returns the the minimum position in the trackbar's range.
Real API_Trackbar_ClearTics ( Real Control ID)

This function removes all tics from a trackbar.

Return value:
No return value.

Real API_Trackbar_GetSelStart ( Real Control ID )

This function returns the starting position of the current selection range.

Return value:
Returns the starting position of the current selection range.

Real API_Trackbar_GetSelEnd ( Real Control ID )

This function returns the ending position of the current selection range.

Return value:
Returns the ending position of the current selection range.


Real API_Trackbar_GetTic ( Real Control ID, Real Zero Based Tic Index)

Retrieves the logical position of a tick mark in a trackbar. The logical position can be any of the integer values in the trackbar's range of minimum to maximum slider positions.

Return value:
Returns the logical position of the specified tick mark, or -1 if argument1 does not specify a valid index.

Real API_Trackbar_SetBuddy ( Real Control ID , Real Buddy Align, Real Buddy Control ID)

This functions adds a buddy control on the left or on the right of the trackbar.

Set argument1 to 1 to place it on the left, set it to 0 to place it on the right.

Return value:
Returns the window handle to the control that was previously assigned to the control at that location.
Real API_Trackbar_SetPos ( Real Control ID , Real Position)

Sets the current logical position of the slider in a trackbar.

Return value:
No return value.
Real API_Trackbar_SetRange ( Real Control ID , Real Minimum, Real Maximum)

Sets the range of minimum and maximum logical positions for the slider in a trackbar.

Return value:
No return value.
Real API_Trackbar_SetSel ( Real Control ID, Real Start Pos, Real End Pos)

This function sets the selection of a trackbar control.

Return value:
No return value.
Real API_Trackbar_SetTic ( Real Control ID, Real Zero Based Tic Index)

Sets a tick mark in a trackbar at the specified logical position.

Return value:
If this function succeeds, it returns true (1), otherwise it returns false (0).

Example code:

is
Trackbar1 = API_Trackbar_Create (Win,50,400,200,40,TBS_AUTOTICKS|TBS_HORZ);

API_Trackbar_SetRange (Trackbar1,0,10); // Set range from 0 to 10

Static1 = API_Static_Create (Win,0,0,40,20); // Create a static as label for the trackbar
Static2 = API_Static_Create (Win,0,0,30,20);

API_Control_SetText (Static1,"100%"); // Set static text
API_Control_SetText (Static2,"0%");

API_Trackbar_SetBuddy (Trackbar1,0,Static1); // Add static next to trackbar
API_Trackbar_SetBuddy (Trackbar1,1,Static2);

Return to help index