From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from DesktopUIControl)

New in 2021r3

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.

Closing FocusLost MouseExit
ConstructContextualMenu FocusReceived MouseMove
ContextualMenuItemSelected KeyDown MouseUp
DragEnter KeyUp MouseWheel
DragExit MouseDown Opening
DragOver MouseDrag ValueChanged
DropObject MouseEnter

Active fa-lock-32.png LockLeft TabIndex
AllowAutoDeactivate LockRight TickMarkStyle
AllowLiveScrolling LockTop Tooltip
AllowTabStop MaximumValue Top
Enabled MinimumValue Transparent
Handle fa-lock-32.png MouseCursor Value
Height Name fa-lock-32.png Visible
Index fa-lock-32.png PageStep Width
Left PanelIndex Window fa-lock-32.png
LineStep Parent
LockBottom Scope fa-lock-32.png

AcceptFileDrop AcceptTextDrop Refresh
AcceptPictureDrop Close SetFocus
AcceptRawDataDrop DrawInto


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

on macOS vertical sliders no longer appear automatically when the height is greater than the width. To enable a vertical slider, put this code in the Opening event handler for the Slider:

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

Sample Code

Changing the maximum value of a DesktopSlider at runtime:

Slider1.MaximumValue = 200

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

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

See Also

DesktopUIControl class; DesktopScrollbar control