TrackBarGadget()

Syntax

Result = TrackBarGadget(#Gadget, x, y, Width, Height, Minimum, Maximum [, Flags])
Description
Creates a TrackBar gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. It allows you to select a range of values with a slide bar, like ones found in several multimedia players. The Minimum-Maximum range should be between 0 and 10,000. #Gadget will be the number returned by EventGadget() command.

'Flags' are always optional and can be composed of one of the following constants:
  #PB_TrackBar_Ticks    : Display a 'tick' marker at each step.
  #PB_TrackBar_Vertical : The trackbar is vertical (instead of horizontal which is the default).
You can add a 'mini help' to this gadget by using GadgetToolTip().

The following commands can be used to act on this gadget:

- GetGadgetState(): Returns the current cursor position (value between the Minimum-Maximum range).
- SetGadgetState(): Change the current cursor position.
- GetGadgetAttribute(): With one of the following attributes:
  #PB_TrackBar_Minimum   : Returns the minimum value.
  #PB_TrackBar_Maximum   : Returns the maximum value. 
- SetGadgetAttribute(): With one of the following attributes:
  #PB_TrackBar_Minimum   : Changes the minimum value.
  #PB_TrackBar_Maximum   : Changes the maximum value. 

Example:
  If OpenWindow(0, 0, 0, 320, 200, "TrackBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    TextGadget    (3, 10,  20, 250, 20,"TrackBar Standard", #PB_Text_Center)
    TrackBarGadget(0, 10,  40, 250, 20, 0, 10000)
    SetGadgetState(0, 5000)
    TextGadget    (4, 10, 100, 250, 20, "TrackBar Ticks", #PB_Text_Center)
    TrackBarGadget(1, 10, 120, 250, 20, 0, 30, #PB_TrackBar_Ticks)
    SetGadgetState(1, 3000)
    TextGadget    (5,  90, 180, 200, 20, "TrackBar Vertical", #PB_Text_Right)
    TrackBarGadget(2, 270, 10, 20, 170, 0, 10000, #PB_TrackBar_Vertical)
    SetGadgetState(2, 8000)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- TextGadget() - Gadget Index - TreeGadget() ->