Desktop Slider

From Xojo Documentation

Slider Library Icon

Although similar to a Scrollbar, a slider is used for selecting a value rather than scrolling information on the screen. The Slider control provides an interface that is clearly for increasing or decreasing a numeric value. Like the Scroll Bar, the Slider control can appear horizontally (which is the default) or vertically. You can create a vertical Slider by changing its height so that it is greater than its width. A Slider automatically maintains the correct proportions regardless of the dimensions you give it.

Refer to Slider in the Language Reference for details on all its events, properties and methods.

Below are the commonly used events and properties.


ValueChanged - This event is called when the Slider position is changed, resulting in its Value property also being changed. It gets called whether the Slider position was changed by the user or by code.


LineStep - On Windows and Linux, LineStep is the amount the Slider moves when it has the focus and the user uses the arrow keys to change its position. On macOS it has no effect.

AllowLiveScrolling - When True, the ValueChanged event is called repeatedly while the slider is being adjusted. When False, ValueChanged is only called once after the user stops adjusting the slider.

MinimumValue - The minimum value for the slider.

MaximumValue - The maximum value for the slider.

PageStep - The amount that the slider value changes (up or down) when the user clicks to the left (or above) or to the right (or below) the slider indicator.

TickMarkStyle - Indicates if tick marks appear on the slider. Uses the TickMarkStyles enum to set the values: None, TopLeft, BottomRight

Value - The actual value (or position) of the slider.

Handling Focus

When a Slider gets the focus (on Windows and Linux), an outline surrounds the control. Pressing the Up or Left arrow key decreases the value of the Slider and pressing the Down or Right arrow key increases the value of the Slider. The amount that the value is changed by each key press is controlled by the Slider’s LineStep property. By default, the Slider has a range of 0 to 100 and LineStep is 1. The user can also click anywhere along the slider’s track to change the slider’s value. The amount that the Slider moves with each click is controlled by the Slider’s PageStep property.


A slider provides a clear visual way for the user to adjust a value. A common use of a slider is to adjust the zoom level of a view. This code in the ValueChanged event handler adjusts the font size for text displayed in a label:

Label1.FontSize = Me.Value

See Also

Slider class