BUTTON item type

Defines a push-button that can trigger an action.

BUTTON item basics

The BUTTON form item type defines a standard push button with a label and/or an icon.

Defining a BUTTON

The label of a BUTTON form item is defined with the TEXT attribute. The COMMENT attribute can be used to define a hint for the button. Consider using localized strings for these attributes.

The picture is defined by the IMAGE attribute. Consider using centralized icons for button images.
BUTTON ...
   TEXT = %"common.button.text.ok",
   IMAGE = "accept",
   COMMENT = %"common.button.hint.ok";

BUTTON form items can inherit action default attributes, to avoid having to specify the TEXT, COMMENT and IMAGE attributes in all elements bound to the same action. For more details, see Configuring actions.

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 and Button style attributes.

Detecting BUTTON action

A BUTTON form item acts as an action view for a dialog action, and is bound to the ON ACTION handler by name. The action name can be prefixed with a sub-dialog identifier and/or a field name, to define a qualified action view:

-- Form file (grid layout)
BUTTON b1: print;

-- Program file:
ON ACTION print
   -- Execute code related to the print action
Note: When controlled by a COMMAND action handler in a DIALOG interactive instruction, form buttons can get the focus and thus be part of the tabbing list (TABINDEX attribute).

For more details, see Binding action views to action handlers.

Where to use a BUTTON

A BUTTON form item can be defined with an item tag and a BUTTON item definition in a GRID, SCROLLGRID and TABLE/TREE.