Returns or set the selection state of a Slider control.
Slider.SelectRange = boolean
Slider.SelLength [= value%]
Slider.SelStart [= value%]
Slider.ClearSel
SelectRange determines whether or not the Slider can have a selected range.
SelLength returns or sets the length of a selected range, and SelStart returns or sets the start of a selected range in a Slider control. The value falls within the Min and Max properties.
The SelLength and SelStart properties are used together to select a range of contiguous values on a Slider control. The Slider control then has the additional advantage of being a visual analog of the range of possible values.
The SelLength property can't be less than 0, and the sum of SelLength and SelStart can't be greater than the Max property.
If SelectRange is set to False, then the SelStart property setting is the same as the Value property setting. Setting the SelStart property also changes the Value property, and vice-versa, which will be reflected in the position of the slider on the control. Setting SelLength when the SelectRange property is False has no effect.
The ClearSel method cears the current selection range in a slider.
Global sldclr?
Ocx Slider sld = "", 10, 10, 400, 20 : .Min = 10 : .Max = 200 : .TickFrequency = 10 : .LargeChange = 10
Ocx CheckBox chk = "Allow Range Selection", 10, 40, 130, 14
sld_Scroll
Do : Sleep : Until Me Is Nothing
Sub chk_Click
sld.SelectRange = -chk.Value
EndSub
Sub sld_Change
sldclr? = True
EndSub
Sub sld_MouseDown(Button&, Shift&, x!, y!)
If sldclr? Then sld.ClearSel : sldclr? = False
EndSub
Sub sld_Scroll
Local fn$ = FontName : FontName = "courier new"
If sld.SelectRange And sld.SelLength > 0
Text 10, 60, "Slider Start Position: " & sld.SelStart & Space(2)
Text 10, 75, "Slider Range Length: " & sld.SelLength & Space(2)
Else
Text 10, 60, "Slider Position: " & sld.Value & Space(20)
Text 10, 75, Space(40)
EndIf
FontName = fn$
EndSub
{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}