Tutorial 2008-04: Radio Button - Fields and Event Trigger
The form widget (graphical form component) can be used for two purposes. It can either be used to view and manage data of a data field (with a set of pre-defined values) or to trigger action or key events.
Radio buttons in general
A radio button group is defined by a ‘single’ entry in the Attributes section within the form definition.
.
.
Radio buttons can be used for
A) data fields controls
Property in the form attributes section:
CLASS=“DEFAULT” #(default)
B) ‘Event’ Trigger
Property in the form attributes section:
CLASS=“KEY”
Each Radio button represents a single value or Event
Accellerator Keys
Radio buttons also support ‘Accelerator Keys’ (Example ALT-P) by adding a ‘&’ symbol prior to the label string
Form ATTRIBUTES section Code Example
config="1 0 {&Private, &Business}“
The label text is static and can not be changed at runtime
Radio buttons and 4GL Attributes:
'Radio Buttons' support following graphical attributes:
- COLOR (Red, Blue, Green, …)
- Font (Script)
Button Navigation and controll for the user
The buttons can be controlled by using the mouse or by tabing into the field and pressing the cursor keys (UP-DOWN or LEFT/RIGHT).
Radio buttons as a ‘Data field control’
Radio Button Groups have a relation to one single field. This means, you can have one or many radio buttons (a radio button group) to read from and write to one single field. Each Radio button represents a 'single' value. If the field value changes, the ‘selected’ button will change. If a user clicks on a different radio button, the field value will change to the corresponding / associated value.
If the field value does not match any of the radio button values, no button will be shown selected.
Radio buttons have an active/inactive state which is controlled by an INPUT
Form ATTRIBUTES section Code Example
ATTRIBUTES
f1=formonly.cust_re,
config="1 0 {Private, Business}“
widget=“radio“;
Radio buttons used as ‘Event Trigger’
Radio buttons can also be used as buttons. If the property class is set to KEY, Action and Key events can be specified to be triggered when the user clicks the radio button.
If the radio button is used as an event trigger, it will be initialised ‘de-activted’ by default.
The status of an radio button event trigger can & needs to be controlled within the 4GL code.
To 'Activate' use the statement
#Syntax: DISPLAY "!" TO <form field name of the radio button>
DISPLAY “!” TO f_rad_filt_event
To 'De-Activate' use the statement
#Syntax: DISPLAY "*" TO <form field name of the radio button>
Deactivated DISPLAY “*” TO f_rad_filt_event
No button will be shown selected until the user clicks one
Form ATTRIBUTES section Code Example:
ATTRIBUTES
f1=formonly.cust_re,
class=“KEY”,
config=“F5 F6 {Filter On, Filter Off}“
widget=“radio“;
Example screen shot with radio button group used as an event trigger

Demo Program
The combo list management functions are also demonstrated with following demo programs
- 'fm_field_widget_radio_1'
- 'fm_field_widget_radio_2'
- 'fm_field_widget_radio_event'
- 'fm_field_widget_radio_simple'
located in the forms demo project.
and in the CMS and GuiDemo demo project.