Trackbar – Giavapps Windows API

 

 

api_trackbar_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a trackbar control.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

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_FIXEDLENGTH The trackbar control allows to change the size of the slider.

TBS_NOTHUMB The trackbar control does not display a slider.

TBS_TOOLTIPS The trackbar control supports ToolTips. When a trackbar control is created using this style, it automatically creates a default ToolTip control that displays the slider’s current position.

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.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new trackbar control.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_trackbar_set_buddy(TrackbarHandle, BuddyHandle, Side) Sets a control as the buddy control for a trackbar. Trackbar buddy controls are automatically displayed in a location relative to the control’s orientation (horizontal or vertical). Trackbar controls support up to two buddy windows.

TrackbarHandle: it must be a TrackbarHandle.
BuddyHandle: handle to the control that will be set as the trackbar control’s buddy.
Side: value specifying the location at which to display the buddy control.

The Side argument can be one of the following values:

false The buddy will appear to the right of the trackbar if the trackbar control uses the TBS_HORZ style. If the trackbar uses the TBS_VERT style, the buddy appears below the trackbar control.

true The buddy will appear to the left of the trackbar if the trackbar control uses the TBS_HORZ style. If the trackbar uses the TBS_VERT style, the buddy appears above the trackbar control.

 

api_trackbar_get_buddy(TrackbarHandle, Side) Returns the handle to a trackbar control buddy window at a given location.

TrackbarHandle: it must be a TrackbarHandle.
Side: value indicating which buddy control handle will be retrieved, by relative location.

The Side argument can be one of the following values:

false Retrieves the handle to the buddy to the right of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy below the trackbar.

true Retrieves the handle to the buddy to the left of the trackbar. If the trackbar control uses the TBS_VERT style, the message will retrieve the buddy above the trackbar.

 

api_trackbar_set_range(TrackbarHandle,Minimum,Maximum) Sets the range of minimum and maximum logical positions for the slider in a trackbar.

TrackbarHandle: it must be a TrackbarHandle.
Minimum: minimum position for the slider.
Maximum: maximum position for the slider.

 

api_trackbar_get_range(TrackbarHandle,MinimumOrMaximum) Returns the range of minimum or maximum position for the slider in a trackbar.

TrackbarHandle: it must be a TrackbarHandle.
MinimumOrMaximum: retrieves the minimum (false) or maximum (true) position for the slider.

 

api_trackbar_set_position(TrackbarHandle,Position) Sets the current logical position of the slider in a trackbar.

TrackbarHandle: it must be a TrackbarHandle.
Position: new logical position of the slider.

 

api_trackbar_get_position(TrackbarHandle) Returns the current logical position of the slider in a trackbar.

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_set_selection(TrackbarHandle, Minimum, Maximum) Sets the minimum and maximum logical positions of the current selection range in a trackbar. This function works only with trackbars that have TBS_ENABLESELRANGE style.

TrackbarHandle: it must be a TrackbarHandle.
Minimum: minimum position of the current selection range.
Maximum: maximum position of the current selection range.

 

api_trackbar_get_selection(TrackbarHandle, MinimumOrMaximum) Returns the minimum or maximum logical positions of the current selection range in a trackbar. (This function works only with trackbars that have TBS_ENABLESELRANGE style)

TrackbarHandle: it must be a TrackbarHandle.
MinimumOrMaximum: retrieves the minimum (false) or maximum (true) position of the current selection range.

 

api_trackbar_reset_selection(TrackbarHandle) Clears the current selection range in a trackbar.

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_set_selection_limit(ParentHandle, TrackbarHandle, Limit) This function limits movements of the slider inside the selection range for the given trackbar. Usually you should use this feature instead of programming your own selection limits because you could get glitches and flickering on the track bar. When you call this function Giavapps Windows API will properly handle the selection limit task for you!

ParentHandle: parent window of the trackbar control.
TrackbarHandle: it must be a TrackbarHandle.
Limit: enables (true) or disables (false) the selection range limit.

 

api_trackbar_get_selection_limit(TrackBarHandle) This function returns true when the selection range limit is enabled for the specified trackbar or false otherwise.

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_set_tick(TrackbarHandle,Position) Sets a tick mark in a trackbar at the specified logical position. The function returns true if the tick mark is set, or false otherwise.

TrackbarHandle: it must be a TrackbarHandle.
Position: logical position.

 

api_trackbar_get_tick(TrackbarHandle, Position) Tests if there is a tick mark in the given position in a trackbar. This function returns true if finds a tick mark or false otherwise.

TrackbarHandle: it must be a TrackbarHandle.
Position: logical position.

 

api_trackbar_get_tick_count(TrackbarHandle) Retrieves the number of tick marks in a trackbar. If no tick flag is set, it returns 2 for the beginning and ending ticks. If TBS_NOTICKS is set, it returns zero. Otherwise, it takes the difference between the range minimum and maximum, divides by the tick frequency, and adds 2.

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_reset_ticks(TrackbarHandle) Removes the current tick marks from a trackbar. This function does not remove the first and last tick marks, which are created automatically by the trackbar.

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_set_slider_length(TrackbarHandle,Length) Sets the length of the slider in a trackbar. (This function works only with trackbars that have TBS_FIXEDLENGTH style)

TrackbarHandle: it must be a TrackbarHandle.
Length: length, in pixels, of the slider.

 

api_trackbar_get_slider_length(TrackbarHandle) Returns the length, in pixels, of the slider in a trackbar. (This function works only with trackbars that have TBS_FIXEDLENGTH style)

TrackbarHandle: it must be a TrackbarHandle.

 

api_trackbar_set_tooltip(TrackbarHandle, TooltipHandle) Assigns a tooltip control to a trackbar control. When a trackbar control is created with the TBS_TOOLTIPS style, it creates a default tooltip control that appears next to the slider, displaying the slider’s current position.

TrackbarHandle: it must be a TrackbarHandle.
TooltipHandle: it must be a TooltipHandle.

 

Code Examples

 

Creating a Trackbar Control

 

trackbar = api_trackbar_create(window,10,10,200,100,WS_VISIBLE | WS_CHILD | TBS_AUTOTICKS | TBS_TOOLTIPS,0);

 

Setting a Buddy Control

 

api_trackbar_set_buddy(trackbar,edit);

 

Setting Range and Position

 

api_trackbar_set_range(trackbar,0,20);
api_trackbar_set_position(trackbar,10);

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*