|
Contents | Previous | Next | Subchapters |
| See Also | textfield |
addcontrol(caption, geometry, "slider", lower, upper, call back)
Adds a "slider" control,
with the specified
geometry
,
to the window specified by
caption
.
The integer scalars lower and upper
specify the lower and upper limits for the sliders value.
The command specified by
call back
is executed whenever the user moves the slider.
The return value is the
control handle
for the text field.
If geometry(3) > geometry(4), the slider moves in the
horizontal direction.
Otherwise, the slider moves in the vertical direction.
If the slider moves horizontally, the value lower
corresponds to the left and upper corresponds
to the right side of the slider control.
If the slider moves vertically, the value lower
corresponds to the bottom and upper corresponds
to the top of the slider control.
getcontrol(handle)
Returns the current position of the "slider" control specified by
handle, where
handle is the value returned by addcontrol
when the "slider" control was created.
The return value is an integer scalar.
setcontrol(handle, index)
Changes the current position of the "slider" control specified by
handle to the value specified index, where
handle is value returned by addcontrol
when the "slider" control was created and index is
an integer scalar between the corresponding values of lower
and upper.
The return value of setcontrol is true, if the
control can be set as requested, and false otherwise.
clear
#
Caption = "Test Dialog"
geometry = [100, 100, 200, 120]
callback = "delwin(Caption);"
adddialog(Caption, geometry, callback);
#
geometry = [20, 20, 160, 20]
lower = 1
upper = 100
initial = 50
Slider = addcontrol(Caption, geometry, "slider", lower, upper, "Callback")
setcontrol(Slider, initial);
#
geometry = [90, 40, 30, 20]
text = clipstr(ntoa(initial))
Label = addcontrol(Caption, geometry, "label", text);
#
geometry = [70, 70, 50, 20]
name = "Done"
callback = [ "print getcontrol(Slider); delwin(Caption);"]
addcontrol(Caption, geometry, "pushbutton", name, callback);
#
function Callback() begin
global Slider, Label
value = getcontrol(Slider)
value = clipstr(ntoa(value))
setcontrol(Label, value);
end