An example of a FRAME with a directly defined radio group looks like this:
You can add RTOGGLE to a
FRAME with the usual positioning and layout commands.
The FRAME has a value member,
VAL, which is the index of currently selected
RTOGGLE for the radio group. You can use this to change the selected
RTOGGLE.
Similarly, you change the value of the FRAME by setting the
VAL member of any of the group’s
RTOGGLEs to true.
Note that the FRAME group value may be set to zero, indicating that there is no selected
RTOGGLE. Similarly if the selected
RTOGGLE value is set to false, then it becomes deselected and the
FRAME value will then be zero.
The default value for an RTOGGLE gadget is
FALSE, and the default value for a
FRAME gadget is zero, i.e. no selected
RTOGGLE.
The FRAME gadget can have an assigned callback, which is executed when the radio group selection is changed, i.e. whenever you select an unselected radio-toggle. As there is only a SELECT action supported, it can be either a simple callback or an open callback.
The form constructor method assigns a simple callback, the form method RGroupSelectionChanged(), to the frame
rg1 (radio group). It then initialises the gadget values and selects the second
RTOGGLE as the default selection.
The group callback uses the FRAME’s
VAL member to get the current selected index and hence the current
RTOGGLE and its
OnValue member value. If the selected
RTOGGLE’S value is ‘radio’ then the selected program is read from the
RADIO option gadget. Finally the selected program string is displayed in the
Selection (read-only) text gadget.
The callback on the RADIO option gadget, detects if the ‘Radio:’
RTOGGLE rad5 is current and if so it deselects it leaving no current selection, and clears the
Selection text field.