A slider is a graphical representation of a numeric value in a
predefined range. The value can be changed by dragging the slider.
Sliders are commonly used to view/edit numeric values that should not be
exact (it is difficult to drag to an exact value). Examples are the
speed of something or a percentage(done).
A slider selects or visualises an numeric value in the range (slider<-low, slider<-high).
Its current value is (as with all dialog_item
objects) accessible through slider<->selection.
The exact value is normally shown in textual form as well. This may be
controlled by slider<->show_value. slider->show_label
determines whether or not the label visible.
If either slider<-low
or slider<-high
is a real object, the
slider will assume it operates on floating point numbers. If both slider<-low
and
slider<-high
is integer, the slider will assume integer values. So, to specify a
slider from 0 to 10 in floating point, use:
?- new(S, slider(value, 0,0, 10.0, 5.0)).
When a slider is operated by the user (by dragging the value), dialog_item<-message
may be send either on termination or at each drag-event. This is
controlled by slider<->drag.
When message is executed, the arguments are:
@receiver The slider @arg1 The current slider <-selection@arg2 The event object.
Bugs: Sliders should be able to handle ranges of floating-point numbers too.
|real|function->restore.<-message
will be activated on each drag-event received by the slider. Otherwise, dialog_item<-message
will only be sent when the mouse-button is released.
Defaults: @off (only send at mouse-up).
printf() call (see also
string->format).
The default format for floating point values is %f and for integers %d.
The following defines a slider in 0.01 steps
from 0.0 .. 1.0:
?- new(S, slider(value, 0.0, 1.0, 0.5)), send(S, format, '%.2f').
|real<-low
this variable describes the (including) range.
<-label
if slider<-show_label
equals @on.
|real<->selection.
See slider->high.
|real<-low <= slider<-selection <= slider<-high.
<-label
of the slider is printed at the left-side in
dialog_item<-label_font.
Defaults: @on
<-value_font.
Defaults: @on
-show_valueDefaults: 200 pixels.
<-area
and slider<-reference using the various
attributes.|real|function->selection.<-message
when the user releases the button (slider<-drag: @off)
or anytime the user moves the pointer with the button held down (slider<-drag: @on).
First tries dialog_item<-event.
|real, high=int|real, value=int|real|function,
message=[code]*<-label, slider<-low, slider<-high
and
slider->default.<-modified
|real->restore.<-selection)
is not equal to the slider<-displayed_value.
slider->modified: @off
sets slider<-displayed_value to slider<-selection.