From Xojo Documentation

Revision as of 13:50, 24 October 2018 by PLefebvre (talk | contribs) (See Also)
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.

Close GotFocus MouseExit
ConstructContextualMenu KeyDown MouseMove
ContextualMenuAction KeyUp MouseUp
DragEnter LostFocus MouseWheel
DragExit MouseDown Open
DragOver MouseDrag ValueChanged
DropObject MouseEnter

Active fa-lock-32.png LockRight TabIndex
AllowAutoDeactivate LockTop TickStyle
AllowTabStop Maximum Tooltip
Enabled Minimum Top
Handle fa-lock-32.png MouseCursor Transparent
Height MouseX fa-lock-32.png TrueWindow fa-lock-32.png
Index fa-lock-32.png MouseY fa-lock-32.png Value
Left Name fa-lock-32.png Visible
LineStep PageStep Width
LiveScroll PanelIndex Window fa-lock-32.png
LockBottom Parent
LockLeft Scope fa-lock-32.png

AcceptFileDrop AcceptTextDrop Invalidate
AcceptPictureDrop Close Refresh
AcceptRawDataDrop DrawInto SetFocus


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.Maximum = 200

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

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

See Also

RectControl class; Scrollbar control; TickStyles enum.