Slider¶
- structure Slider¶
Slider
widgets are created viaBOX:ADDHSLIDER
andBOX:ADDVSLIDER
.A
Slider
is a widget that holds the value of aScalar
that the user can adjust by moving a sliding marker along a line.It is suited for real-number varying values, but not well suited for integer values.
Suffix
Type
Description
Every suffix of
WIDGET
The current value. Initially set to
MIN
.Your function called whenever the
VALUE
changes.The minimum value (leftmost on horizontal slider).
The maximum value (bottom on vertical slider).
- Slider:ONCHANGE¶
- Type
- Access
Get/Set
This
KOSDelegate
takes one parmaeter, the value, and returns nothing.This allows you to set a callback delegate to be called whenever the user has moved the slider to a new value. Note that as the user moves the slider to a new position, this will get called several times along the way, giving sevearl intermediate values on the way to the final value the user leaves the slider at.
Example:
set mySlider:ONCHANGE to whenMySliderChanges@. function whenMySliderChanges { parameter newValue. print "Value is " + round(100*(newValue-mySlider:min)/(mySlider:max-mySlider:min)) + "percent of the way between min and max.". }
This suffix is intended to be used with the callback technique of widget interaction.
- Slider:MIN¶
- Type
- Access
Get/Set
The “left” (for horizontal sliders) or “top” (for vertical sliders) endpoint value of the slider.
Note that despite the name,
MIN
doesn’t have to be smaller thanMAX
. IfMIN
is larger thanMAX
, then that causes the slider to swap their meaning, and reverse its direction. (i.e. where numbers normally get larger when you slide to the right, inverting MIN and MAX causes the numbers to get larger when you slide to the left.)
- Slider:MAX¶
- Type
- Access
Get/Set
The “right” (for horizontal sliders) or “bottom” (for vertical sliders) endpoint value of the slider.
Note that despite the name,
MIN
doesn’t have to be smaller thanMAX
. IfMIN
is larger thanMAX
, then that causes the slider to swapr their meaning, and reverse its direction. (i.e. where numbers normally get larger when you slide to the right, inverting MIN and MAX causes the numbers to get larger when you slide to the left.)