Difference between revisions of "DesktopSlider"

From Xojo Documentation

(Created page with "N/A")
 
 
Line 1: Line 1:
N/A
+
{{ClassBox
 +
| super=[[DesktopUIControl]]
 +
| platform=all
 +
| scope=global
 +
| newinversion=2021r3
 +
}}
 +
{{Description
 +
| text=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.
 +
}}
 +
 
 +
<dynamicTable id="Events" super="DesktopUIControl" class="eventTable" title="Events" columns="3">
 +
{{Event | name=ValueChanged | description=ValueChanged()&#x0A;The slider&rsquo;s value has changed. }}
 +
</dynamicTable>
 +
 
 +
 
 +
<dynamicTable id="Properties" super="DesktopUIControl" class="propertyTable" title="Properties" columns="3">
 +
{{Property | name=AllowLiveScrolling |description=( Boolean)&nbsp;&nbsp;If True, a ValueChanged event occurs as the user drags the thumbnail in the slider.}}
 +
{{Property | name=LineStep | type=Integer | platform=all | description=( Integer)&nbsp;&nbsp;On Windows and Linux, LineStep is the amount a slider moves when the slider has the focus and the user uses the arrow keys }}
 +
{{Property | name=MaximumValue | description=( Integer)&nbsp;&nbsp;The maximum value of the slider. The default is 100. }}
 +
{{Property | name=MinimumValue | description=( Integer)&nbsp;&nbsp;The minimum value of the slider. The default is 0. }}
 +
{{Property | name=PageStep | type=Integer | platform=all | description=( Integer)&nbsp;&nbsp;The amount the value changes when the user clicks in the Slider track. }}
 +
{{Property | name=TickMarkStyle | description=( Slider}&nbsp;&nbsp;The style of tick mark to be displayed. }}
 +
{{Property | name=Value | type=Integer | platform=all | description=( Integer)&nbsp;&nbsp;The current value of the slider. }}
 +
</dynamicTable>
 +
 
 +
 
 +
<dynamicTable id="Methods" super="DesktopUIControl" class="methodTable" title="Methods" columns="3">
 +
</dynamicTable>
 +
 
 +
<dynamicTable id="Enumerations" class="methodTable" title="Enumerations" columns="3">
 +
{{Enum | name=TickMarkStyles | description=Specifies the type of tick mark for the slider.}}
 +
</dynamicTable>
 +
 
 +
== Notes ==
 +
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 [[DesktopControl.Opening|Opening]] event handler for the Slider:
 +
 
 +
<rbcode>
 +
Declare Sub setVertical Lib "Cocoa" Selector "setVertical:" (windowRef As Integer, id As Boolean)
 +
setVertical(Me.Handle, True)
 +
</rbcode>
 +
 
 +
== Sample Code ==
 +
Changing the maximum value of a '''DesktopSlider''' at runtime:
 +
 
 +
<rbcode>
 +
Slider1.MaximumValue = 200
 +
</rbcode>
 +
 
 +
Setting the text of TextField1 to the value of the slider when the user scrolls.
 +
 
 +
<rbcode>
 +
Sub ValueChanged()
 +
  TextField1.Value = Slider1.Value.ToString
 +
End Sub
 +
</rbcode>
 +
 
 +
==See Also==
 +
[[DesktopUIControl]] class; [[DesktopScrollbar]] control
 +
 
 +
[[Category:Desktop]]
 +
[[Category:Desktop Controls]]

Latest revision as of 20:21, 23 July 2021

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.

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


Properties
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


Methods
AcceptFileDrop AcceptTextDrop Refresh
AcceptPictureDrop Close SetFocus
AcceptRawDataDrop DrawInto
Enumerations
TickMarkStyles

Notes

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