Difference between revisions of "Slider"

From Xojo Documentation

Line 1: Line 1:
{{SupportedPlatforms | type=d}}{{WebApp | link=[[WebSlider]]}}
{{SupportedPlatforms | type=d}}{{WebApp | link=[[WebSlider]]}}

Latest revision as of 20:56, 13 September 2021

For web apps, see WebSlider.

Class (inherits from RectControl)

The slider control used by desktop applications. As the user moves the slider, the Value property changes. To create a vertical slider, make the height greater than the width.

GotFocus MouseDown MouseUp
LostFocus MouseDrag ValueChanged

AllowLiveScrolling MinimumValue Value
LineStep PageStep
MaximumValue TickMarkStyle



Sliders default to a height of 23 pixels so they use the normal size on all platforms.

On macOS Sierra (10.12) and later, vertical sliders no longer appear automatically when the height is greater than the width. To enable a vertical slider, put this code in the Open event handler for the Slider:

Declare Sub setVertical Lib "Cocoa" Selector "setVertical:" (windowRef As Integer, id As Boolean)
setVertical(Me.Handle, True)


Changing the maximum value of a Slider at runtime:

Slider1.MaximumValue = 200

Setting the text of TextField1 to the value of the slider when the user scrolls.

Sub ValueChanged()
TextField1.Value = Str(Slider1.Value)
End Sub

See Also

RectControl class; Scrollbar control; TickMarkStyles enum.