Sliders or Track Bars as they are sometimes called, allow users to easily select a numeric value within a minimum and maximum range. Users can adjust the Slider by grabbing the thumb button with the mouse or finger and dragging it to a new location along the track. As the thumb button moves, the variable assigned to the Slider will be updated with the current position on the track. The position or value can be used in calculations or sent to a server, etc.
To create a Slider, use the mouse to draw a rectangle where you would like the object to appear. The Slider properties can be accessed from the Properties Panel, allowing you to define the appearance and behaviour.
- min-value and max-value: Use these properties to enter the lowest and highest values to define the Slider’s range. The minimum value must be less than the maximum value.
- initial-value: The Slider will be initialized to the specified Initial value when your App starts. The initial value must be within the minimum and maximum range.
- kind: choose a predefined design from the list.
- track-image and thumb-image: Optionally you can choose an image to be placed as a track or thumb to customize their appereance.
- track-height and thumb-width: Use a numeric value on these properties to customize the size of the track and thumb respectively.
- variable: In order to keep track of the position of the Slider while your App is running, you will need to assign the object a unique variable name ie [slider1]. At runtime, the variable will contain the value of the Slider.
You can modify the value of the Slider programmatically by manipulating the variable using a simple Action command. For example:
SetVar "[slider1]" 50
You can provide users with additional feedback by placing a Paragraph object next to the Slider. Write the Slider's variable [slider1] into the object text property and the text will update with the Slider's value whenever the thumb button is moved.