Frame Radio Groups
- Last UpdatedNov 13, 2025
- 3 minute read
A FRAME may have a set of RTOGGLE gadgets defined directly within it which act in concert as a radio group.
An example of a FRAME with a directly defined radio group looks like this:

The radio group action only applies to FRAME gadgets of type NORMAL, PANEL, FOLDUPPANEL.
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, that means, no selected RTOGGLE.
Frame Callbacks
The FRAME gadget can have an assigned callback, which is executed when the radio group selection is changed, that means, whenever the user selects 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 definition below is a simple TV and radio station selector, shown above.
setup form !!FRGTest dialog noAlign
title |Select a program|
Frame .rg1 |TV and Radio|
path down
text .choice tagwid 6 |Selection:| width 12 is STRING
rToggle .rad1 tagwid 7 |BBC 1| States '' 'BBC 1'
path right
valign centre
rToggle .rad2 tagwid 7 |BBC 2| States '' 'BBC 2'
rToggle .rad3 tagwid 7 |Anglia| States '' 'Anglia'
rToggle .rad4 tagwid 7 |Chan 4| at xmin.rad1 ymax.rad1 States '' 'Chan 4'
rToggle .rad5 tagwid 7 |Radio:| States '' 'radio'
option .Radio width 10
exit
button .cancel |Cancel| at xmin form ymax form + 0.2 CANCEL
button .ok | OK | at xmax form - size OK
- set focus to button to ensure to ensure Windows does not set it to first Rtoggle
!this.keyboardFocus = !this.ok
exit
Note: The form’s keyboard focus is initially placed on the OK button to prevent it being assigned (by Windows) to the first RTOGGLE rad1 (effectively the first interactive gadget on the form as the text field Selection is read-only)
The form constructor method assigns a simple callback, the form method RGroupSelectionChanged(), to the frame rg1 (radio group). It then initializes the gadget values and selects the second RTOGGLE as the default selection.
define method .FRGTest()
-- Constructor
-- Frame radiogroup with simple callback
!this.rg1.callback = '!this.RGroupSelectionChanged( )'
-- set result field read-only
!this.choice.setEditable(false)
-- Radio choices
!this.rad5.setTooltip(|select your Radio option|)
!radio[1] = 'Q103'
!radio[2] = 'Hereward'
!radio[3] = 'Cambridge'
!radio[4] = 'ClassicFM'
!radio[5] = 'Caroline'
!this.Radio.dtext = !radio
!this.Radio.setTooltip(|change your Radio option|)
!this.Radio.callback = '!this.selectProgram(!this.rad5)'
-- set initial value
!this.rg1.val = 2
!this.RGroupSelectionChanged( )
Endmethod
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.
define method .RGroupSelectionChanged( )
-- Service radiogroup select event
!Frame = !this.rg1
!index = !Frame.val
!rTog = !Frame.RToggle(!index)
!value = !rTog.onValue
-- Do some application actions
if( !value eq 'radio' ) then
!value = !this.Radio.selection('dtext')
endif
!this.choice.val = !value
endmethod
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.
define method .selectProgram( !rtog is GADGET )
-- Select new program from option list
if( !this.rg1.val eq !rtog.index ) then
-- rtog is current, so deselect it within group
!this.rg1.val = 0
!this.choice.clear()
endif
endmethod