Using RadioButtons

RadioButtons are round buttons that represent mutually exclusive options. When a RadioButton is selected, it has a dark center; when it is not selected, the center is blank. RadioButtons exist in groups. Exactly one RadioButton is selected in each group.

NoteSmartphone platforms The Action key on a Smartphone device or emulator selects or clears a single radio button, but does not change other radio buttons in the same radio button group. Avoid using radio buttons in applications deployed to Smartphone platforms. You should use check boxes or list boxes instead.

When a window opens, one RadioButton in a group must be selected. You specify which RadioButton is initially selected by selecting the Checked property in the General properties page in the RadioButton's Properties view. When the user clicks a RadioButton in a deployed application, the RadioButton becomes selected, and the previously selected RadioButton in the group becomes deselected.

Use RadioButtons to represent the state of an option. Do not use them to invoke actions.

Grouping RadioButtons

By default, all RadioButtons in a window are in one group, regardless of their location in the window. Only one RadioButton can be selected at a time.

You use a GroupBox control to group related RadioButtons. All RadioButtons inside a GroupBox are considered to be in one group. One button can be selected in each group.

Figure 11-3: RadioButtons in 2 GroupBox controls

At left is a group box with the label Style in its top left corner. It contains three vertically aligned radio buttons labeled Plain, Bold, and Italic. The first radio button has a black center, indicating it is selected. To the right is a group box with the label Size in its top left corner. It contains three radio buttons aligned vertically and labeled 14, 18, and 24. The button labeled 18 has a black center, indicating that it is currently selected.

The Automatic property

When a window contains several RadioButtons that are outside of a GroupBox, the window acts as a GroupBox. Only one RadioButton can be selected at a time, unless the check box for the Automatic property on the RadioButton’s General properties page is cleared. When the Automatic property is not set, you must use scripts to control when a button is selected. Multiple RadioButtons can be selected outside of a group.

The Automatic property does not change how RadioButtons are processed inside a GroupBox.