src/swipl-devel/packages/xpce/man/refmanual/md/slider.md

class slider {#class-slider}

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 (<-low, <-high). Its current value is (as with all dialog_item objects) accessible through <->selection. The exact value is normally shown in textual form as well. This may be controlled by <->show_value. ->show_label determines whether or not the label visible.

If either <-low or <-high is a real object, the slider will assume it operates on floating point numbers. If both <-low and <-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), <-message may be send either on termination or at each drag-event. This is controlled by <->drag. When message is executed, the arguments are:

| @receiver | The slider              |
| @arg1     | The current <-selection |
| @arg2     | The event object.       |

Bugs: Sliders should be able to handle ranges of floating-point numbers too.

@see class scroll_bar @see class dialog_item @see class text_item

Instance variables {#class-slider-instvars}

Send methods {#class-slider-send}

Get methods {#class-slider-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.