SLIDER item type

Defines a slider form item.

SLIDER item basics

The SLIDER form item defines a field where the user can set a value in a given range, such as a typical audio volume control widget where you can grab the slider handle to change the value.

Use a SMALLINT or INTEGER variable with a SLIDER form item, larger types like BIGINT or DECIMAL are not supported.

Defining a SLIDER

A SLIDER field allows the user to move a handle along a horizontal or vertical groove and translates the handle's position into a value within the legal range.

The VALUEMIN and VALUEMAX attributes define respectively the lower and upper integer limit of the slider information. Any value outside this range will not be displayed. The step between two marks is defined by the STEP attribute. If VALUEMIN and/or VALUEMAX are not specified, they default respectively to 0 (zero) and 5.

The ORIENTATION attribute defines whether the SLIDER is displayed vertically or horizontally.

This item type is not designed for CONSTRUCT, as the user can only select one value.

Front-ends support different presentation and behavior options, which can be controlled by a STYLE attribute. For more details, see Style attributes common to all elements.

Detecting SLIDER item selection

To inform the dialog when a value changes, define an ON CHANGE block for the SLIDER field. The program can then react immediately to user changes in the field:

-- Form file (grid layout)
SLIDER s1 = options.opts_volume,
   VALUEMIN=0, VALUEMAX=100;

-- Program file:
ON CHANGE opts_volume
   -- A value changed in the slider

For more details, see Reacting to field value changes.

Where to use a SLIDER

A SLIDER form item can be defined in different ways:
  1. With an item tag and a SLIDER item definition in a grid-layout container (GRID, SCROLLGRID and TABLE).
  2. As a SLIDER stack item in a STACK container.