Create a slider

slider text size
(slider text size range)
(slider text size range x0)

Creates a slider in the graphics window. Title of the slider is set to text. Size is a two- or four-element collection; 1st and 2nd element is the position with respect to the left and top borders of the window, respectively; 3rd and 4th element (if present) is the width and the height of the slider, respectively. Size and location are given in pixels and do not depend on the drawing scales.
Values range can be specified optionally as a list or array {min max step}. If step is omitted then values are continuous. The default range is {1 100}. Also the initial value can be provided as an optional argument x0. The default initial value is the range minimum.
Current value of the slider can be obtained with getvalue instruction.

Example:

"s := (slider "Slider {10 20} {0 10 0.5} 3)
setonchange :s [print getvalue :s]

Output:
Slider in the graphics window. Current value of the slider is printed in the text output on each change.

3
3.5
4
4.5
5
5.5
...

See also:

Table of Content