Like a scroll bar, a trackbar is used as a scrolling control, but clicking on the trackbar slider moves it in discrete increments instead of continuously. The HTrackBar control has a series of tick marks along the bottom of the trackbar channel.
To enable this control to be used properly from the keyboard, you must add code to the LineLeft, LineRight, PageLeft, and PageRight events. The code you add should change the slider Position property by the appropriate value and then pass the new slider position to the object or objects you associate with the trackbar control. You must code the Moved event if you want the trackbar control to pass on the slider position after the slider is dragged with a mouse.
Usage note
Use a trackbar when you want the user to select a discrete value. For example, you can use a trackbar to enable a user to select a timer interval or the size of a window.
HTrackBar property |
Datatype |
Description |
---|---|---|
String |
A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users. |
|
String |
A label that briefly describes the control, such as the text in a button or the name of a menu item. |
|
AccessibleRole (enumerated) |
Describes what kind of user interface element the control is. |
|
Boolean |
Specifies whether PowerBuilder moves the control to the top of the front-to-back order. Values are: TRUE -- Control moved to top. FALSE -- Control not moved to top. |
|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the object or control. |
Boolean |
Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are: TRUE -- When the control is clicked, the control is automatically in Drag mode. FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function. |
|
String |
Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control. When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays. |
|
Integer |
Specifies the height of the control, in PowerBuilder units. |
|
LineSize |
Integer |
Specifies how far the slider moves in response to keyboard input from the arrow keys. Setting LineSize to 1 indicates moving 1 increment in the range of values specified by the MaxPosition and MinPosition properties. |
Integer |
Specifies the value of the Position property when the slider is at the right edge of the control. |
|
Integer |
Specifies the value of the Position property when the slider is at the left edge of the control. |
|
PageSize |
Integer |
Specifies how far the slider moves in response to clicking in the slider channel area or pressing the Page keys. The default size is the difference between the MaxPosition and MinPosition properties divided by 5. |
String |
Specifies the name of the stock pointer or file containing the pointer used for the control. |
|
Integer |
Specifies a value between MinPosition and MaxPosition specifying the position of the slider. |
|
Slider |
Boolean |
Specifies whether or not the trackbar contains a slider. |
SliderSize |
Integer |
Specifies the size of the slider on the trackbar. A value of 0 makes the slider the default size. |
Integer |
Specifies the tab value of the control within the window (0 means the user cannot tab to the control). |
|
String |
Specifies the tag value assigned to the control. |
|
TickFrequency |
Integer |
Specifies tick mark frequency. Setting TickFrequency to 1 indicates 1 tick mark for each increment in the trackbar range of values. |
TickMarks |
HTickMarks (enumerated) |
Specifies where tickmarks should be displayed. Values are: HTicksOnBottom! HTicksOnTop! HTicksOnBoth! HTicksOnNeither! |
Boolean |
Specifies whether the control is visible. Values are: TRUE -- Control is visible. FALSE -- Control is not visible. |
|
Integer |
Specifies the width of the control, in PowerBuilder units. |
|
Integer |
Specifies the X position (the distance from the left edge of the window), in PowerBuilder units. |
|
Integer |
Specifies the Y position (the distance from the top of the window), in PowerBuilder units. |
HTrackBar event |
Occurs |
---|---|
Constructor in PowerScript Reference |
Immediately before the Open event occurs in the window |
Destructor in PowerScript Reference |
Immediately after the Close event occurs in the window |
DragDrop in PowerScript Reference |
When a dragged control is dropped on the control |
DragEnter in PowerScript Reference |
When a dragged control enters the control |
DragLeave in PowerScript Reference |
When a dragged control leaves the control |
DragWithin in PowerScript Reference |
When a dragged control is within the control |
GetFocus in PowerScript Reference |
Just before the control receives focus (before it is selected and becomes active) |
Help in PowerScript Reference |
When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control |
LineLeft in PowerScript Reference |
When the left arrow key is clicked |
LineRight in PowerScript Reference |
When the right arrow key is clicked |
LoseFocus in PowerScript Reference |
When the control loses focus (becomes inactive) |
Moved in PowerScript Reference |
When the slider is moved (use the Position property to determine the new location) |
Other in PowerScript Reference |
When a Windows message occurs that is not a PowerBuilder event |
PageLeft in PowerScript Reference |
When the Page Up key is clicked or when mouse clicks are made to the left of the slider in the trackbar channel |
PageRight in PowerScript Reference |
When the Page Down key is clicked or when mouse clicks are made to the right of the slider in the trackbar channel |
RButtonDown in PowerScript Reference |
When the right mouse button is pressed on the control |
HTrackBar function |
Datatype returned |
Description |
---|---|---|
ClassName in PowerScript Reference |
String |
Returns the name assigned to the control. |
Drag in PowerScript Reference |
Integer |
Starts or ends the dragging of the control. |
GetContextService in PowerScript Reference |
Integer |
Creates a reference to a context-specific instance of the specified service. |
GetParent in PowerScript Reference |
PowerObject |
Returns a reference to the name of the parent object. |
Hide in PowerScript Reference |
Integer |
Makes the control invisible. |
Move in PowerScript Reference |
Integer |
Moves the control to a specified location. |
PointerX in PowerScript Reference |
Integer |
Returns the distance of the pointer from the left edge of the control. |
PointerY in PowerScript Reference |
Integer |
Returns the distance of the pointer from the top of the control. |
PostEvent in PowerScript Reference |
Boolean |
Adds an event to the end of the message queue for control. |
Print in PowerScript Reference |
Integer |
Prints the control. |
Resize in PowerScript Reference |
Integer |
Changes the size of the control. |
SelectionRange in PowerScript Reference |
Integer |
Sets a selection range for the trackbar. When you select a range, a blue line is drawn in the channel of the trackbar and two arrows are drawn where the tickmarks are placed to indicate the beginning and end of the selection range. |
SetFocus in PowerScript Reference |
Integer |
Sets the focus to the control. |
SetPosition in PowerScript Reference |
Integer |
Specifies the position of the control in the front-to-back order of the window. |
SetRedraw in PowerScript Reference |
Integer |
Controls automatic redrawing of the control after each change in its properties. |
Show in PowerScript Reference |
Integer |
Makes the control visible. |
TriggerEvent in PowerScript Reference |
Integer |
Triggers a specified event in the control and executes the script for the event. |
TypeOf in PowerScript Reference |
Object |
Returns the type of the control. |