SPINEDIT item type

Defines a spin box widget to enter integer values.

SPINEDIT item basics

The SPINEDIT form item defines a field dedicated to numeric values. Depending on the front-end platform, the widget may provide buttons to increment/decrement the field value.

Use a SMALLINT or INTEGER variable with a SPINEDIT form item. Larger types like BIGINT or DECIMAL are not supported.

Defining a SPINEDIT

The increment between two values is defined by the STEP attribute:
SPINEDIT ...
   STEP = 5;

The VALUEMIN and VALUEMAX attributes define respectively the lower and upper integer limit of the spin-edit range. There is no default minimum or maximum value for the SPINEDIT widget.

Note: This widget is not designed for CONSTRUCT, as you can only enter an integer value.

Front-ends support different presentation and behavior options, which can be controlled by a STYLE attribute. For more details, see Common style attributes.

Detecting SPINEDIT modification

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

-- Form file (grid layout)
SPINEDIT s1 = options.opts_rate,
   VALUEMIN=0, VALUEMAX=100, STEP=5;

-- Program file:
ON CHANGE opts_rate
   -- The value of the spinedit has changed

For more details, see Reacting to field value changes.

Where to use a SPINEDIT

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