WIDGET attribute

The WIDGET attribute specifies the type of graphical widget to be used for a field.

Syntax

Important: This feature is deprecated, its use is discouraged although not prohibited.
WIDGET = "identifier"
  1. identifier defines the type of widget, it can be one of the keywords listed in Table 1.

Usage

The WIDGET attribute defines the type of widget to be used for a form field.

This attribute is used with CONFIG, CLASS, and INCLUDE attributes, to define parameters for the field widget.

Note: The WIDGET attribute is deprecated, use new form item types instead.

The identifier widget type is case sensitive, only uppercase letters are recognized.

When you use the WIDGET attribute, the form cannot be properly displayed on character based terminals, it can only be displayed on graphical front-ends.

Table 1. Supported widgets
Symbol Effect Other attributes
Canvas

The field is used as a drawing area.

Field must be declared as FORMONLY field.

None.
BUTTON The field is presented as a button widget with a label. CONFIG: The unique parameter defines the key to be sent when the user clicks on the button. Button text is defined in configuration files or from the program with a DISPLAY TO instruction.

For example:

CONFIG = "Control-z"

BMP The field is presented as a button with an image. CONFIG: First parameter defines the image file to be displayed, second parameter defines the key to be sent when the user clicks on the button.

For example:

CONFIG = "smiley.bmp F11"

Important: Image files are not centralized on the machine where the program is executed; image files must be present on the Workstation. See front-end specific documentation for more details.
CHECK The field is presented as a checkbox widget. It can be used with the CLASS attribute to change the behavior of the widget.

CONFIG: First and second parameters define the values corresponding respectively to the state "Checked" / "Unchecked" of the check box, while the third parameter defines the label of the checkbox.

For example:

CONFIG = "Y N Confirmation"

If the text part must include spaces, add {} curly brakets around the text:

CONFIG= "Y N {Order validated}"

If the CLASS attribute is used with the "KEY" value, the first and second parameters defines the keys to be sent respectively when the checkbox is "Checked" / "Unchecked", and the third parameter defines the label of the checkbox as with normal checkbox usage.

For example (line breaks added for document readability):

CLASS = "KEY",
CONFIG = "F11 F12 Confirmation"

COMBO The field is presented as a combobox widget. It can be used with the CLASS attribute to change the behavior of the widget. INCLUDE: This attribute defines the list of acceptable values that will be displayed in the combobox list.

For example (line breaks added for document readability):

INCLUDE = ("Paris", "London", "Madrid")

Important: The INCLUDE attribute cannot hold value range definitions, because all items must be explicitly listed to be added to the combobox list.

The following example is not supported:

INCLUDE = (1 TO 10)

FIELD_BMP The field is presented as a normal editbox, plus a button on the right.

CONFIG: The first parameter defines the image file to be displayed in the button; the second parameter defines the key to be sent when the user clicks on the button.

For example:

CONFIG = "combo.bmp Control-z"

LABEL The field is presented as a simple label, a read-only text. None.
RADIO The field is presented as a radiogroup widget. CONFIG: Parameter pairs define respectively the value and the label corresponding to one radio button.

For example (line breaks added for document readability):

CONFIG =
"AA First BB Second CC Third"

If the radio texts must include spaces, add {} curly brakets around the texts (line breaks added for document readability):

CONFIG = "AA {First option}
BB {Second option} CC {Third option}"

If the CLASS attribute is used with the value "KEY", the first element of each pairs represents the key to be sent when the user selects a radio button.

For example (line breaks added for document readability):

CLASS = "KEY",
CONFIG = "F11 First F12 Second
F13 Third"

Controlling old style widgets activation

The following list of widgets can be enabled or disabled from programs with a DISPLAY TO instruction:

  • Text buttons (WIDGET="BUTTON")
  • Image buttons (WIDGET="BMP")
  • Checkboxes of class "KEY" (WIDGET="CHECK", CLASS="KEY")
  • Radio buttons of class "KEY" (WIDGET="RADIO", CLASS="KEY")

If you display an exclamation mark in such fields, the button is enabled, but if you display a star (*), it is disabled:

DISPLAY "*" TO button1 # disables the button
DISPLAY "!" TO button1 # enables the button

Changing the text of WIDGET="BMP" fields

The text of button fields (WIDGET="BUTTON") can be changed from programs with the DISPLAY TO instruction:
DISPLAY "Click me" TO button1 
 # Sets text and enables the button

Changing the image of WIDGET="BMP" fields:

The image of button fields (WIDGET="BMP") can be changed from programs with the DISPLAY TO instruction:
DISPLAY "smiley.bmp" TO button1
 # Sets image and enables the button

Image files are not centralized on the machine where the program is executed; image files must be present on the Workstation. See front end specific documentation for more details.

Changing the text of WIDGET="LABEL" fields:

The text of label fields (WIDGET="LABEL") can be changed from programs with the DISPLAY TO instruction:
DISPLAY "Firstname" TO l_firstname
 # Sets text of the label field

Using WIDGET="Canvas" fields:

The fields declared with the WIDGET="Canvas" attribute can be used by the program as drawing areas. Canvas fields must be defined in the LAYOUT section. A set of drawing functions are provided to fill canvas fields with graphical elements.