Alternative name: Option
The Radio class implements 'radio' buttons, for selecting one-of-many mutually-exclusive options.
You typically set the caption property which indicates the caption associated with the control, and you might set the enabled property to 1 or 0 depending on whether a particular option is valid. The value property is 1 if the control is selected, and 0 otherwise. Only one radio button in a group can be selected at any time; selecting a different Radio button automatically de-selects the current one.
For Radio buttons, it is not always necessary to have any callbacks defined, since when the dialog ends or a Button is pressed you can determine the state of Radio objects using the value property. In other cases, use of an onClick callback to detect changes in the state of these controls may be preferable, and it is necessary if other items in a dialog need to depend on the state of the Radio or Check boxes.
The group property of a Radio button determines which group (within a particular control) the button belongs to. Only one Radio button in the group can be selected at any time, so that if one is selected, all others in the same group are automatically de-selected.
Usually, this grouping occurs automatically (typically, you place Radio buttons in a Frame object). The initial group property for the first Radio button to be created as the child of a Frame or Window is 0. If you create further Radio buttons one after another with the same parent, the group property for each new button is the same as that of the previous button, so each button in the series belongs to the same group.
If you create a different type of control in between, the group property is incremented by one for the next series, so that the second series of Radio buttons behaves independently of the first.
Alternatively, you can override this behavior and set the Radio button's group explicitly, as an integer scalar in the range 0 to 255.
To provide help text when the user moves the mouse pointer over the control and pauses, you can use the tooltip property.
∇DEMO_Radio;DEMO  ⍝ Sample function demonstrating use of Radio buttons  DEMO←'⎕' ⎕NEW 'Dialog' ⋄ DEMO.scale←1  DEMO.title←'Radio Example'  ⍝  DEMO.RADIO1.New 'Radio'  DEMO.RADIO1.where←2 3 1 30  DEMO.RADIO1.caption←' APLX for MacOS'  ⍝  DEMO.RADIO2.New 'Radio'  DEMO.RADIO2.where←3.5 3 1 30  DEMO.RADIO2.caption←'APLX for Windows'  ⍝  DEMO.RADIO3.New 'Radio'  DEMO.RADIO3.where←5 3 1 30  DEMO.RADIO3.caption←'APLX for Linux'  DEMO.RADIO3.value←1  ⍝  DEMO.RADIO4.New 'Radio'  DEMO.RADIO4.where←6.5 3 1 30  DEMO.RADIO4.caption←'APLX for Solaris'  DEMO.RADIO4.enabled←0  ⍝  ⍝ Wait for the user to close the window  0 0⍴⎕WE DEMO ∇
align anchors aquaadjust autodraw caption children class color data doublebuffered dragsource droptarget enabled events extent font group handle maxsize methods minsize name opened order pointer properties scale self size sourceformats tabstop targetformats tie units value visible where winptr
onClick onClose onDblClick onDestroy onDragDrop onDragEnd onDragEnter onDragLeave onDragOver onDragStart onFocus onHide onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseUp onOpen onSend onShow onUnFocus
Copyright © 1996-2010 MicroAPL Ltd