Topic: APLX Help : System Classes : List of Classes : Radio
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Radio


Alternative name: Option

Description

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.

Example

     ∇DEMO_Radio;DEMO
[1]   ⍝ Sample function demonstrating use of Radio buttons
[2]   DEMO←'⎕' ⎕NEW 'Dialog' ⋄ DEMO.scale←1
[3]   DEMO.title←'Radio Example'
[4]   ⍝
[5]   DEMO.RADIO1.New 'Radio'
[6]   DEMO.RADIO1.where←2 3 1 30
[7]   DEMO.RADIO1.caption←' APLX for MacOS'
[8]   ⍝
[9]   DEMO.RADIO2.New 'Radio'
[10]  DEMO.RADIO2.where←3.5 3 1 30
[11]  DEMO.RADIO2.caption←'APLX for Windows'
[12]  ⍝
[13]  DEMO.RADIO3.New 'Radio'
[14]  DEMO.RADIO3.where←5 3 1 30
[15]  DEMO.RADIO3.caption←'APLX for Linux'
[16]  DEMO.RADIO3.value←1
[17]  ⍝
[18]  DEMO.RADIO4.New 'Radio'
[19]  DEMO.RADIO4.where←6.5 3 1 30
[20]  DEMO.RADIO4.caption←'APLX for Solaris'
[21]  DEMO.RADIO4.enabled←0
[22]  ⍝
[23]  ⍝ Wait for the user to close the window
[24]  0 0⍴⎕WE DEMO
     ∇

Properties

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

Methods

Click Clienttoscreen Close Create Delete Draw Focus Hide New Open Paint Resize Screentoclient Send Set Show Trigger

Callbacks

onClick onClose onDblClick onDestroy onDragDrop onDragEnd onDragEnter onDragLeave onDragOver onDragStart onFocus onHide onKeyDown onKeyPress onKeyUp onMouseDown onMouseMove onMouseUp onOpen onSend onShow onUnFocus


Topic: APLX Help : System Classes : List of Classes : Radio
[ Previous | Next | Contents | Index | APL Home ]