OptionButton Class

An option button (radio button) control displays an option that can be turned on or off. Only one of a group of option buttons can be turned on. As the OptionButton class is a subclass of the Control class, it inherits all of the properties and methods defined in the Control and Window classes.

Usually, option buttons are used as part of a group to display multiple options from which the user can select only one. You can group option buttons by drawing them inside another control that accepts children (for example, a Frame control or GroupBox control), or you can add them directly to a form.

To group option buttons in a parent control, draw the parent first and then draw the option buttons inside it. All option buttons within the same parent are treated as a group. Option buttons on a form are also treated as a separate group from any option buttons in a control.

While option buttons and check boxes may appear to function similarly, there is an important difference: when a user selects an option button, the other option buttons in the same group are automatically cancelled. In contrast, any number of check boxes can be selected.

The height of the option button is automatically set to fit the caption.

When focus is on an option button, the right and down arrow keys move the focus to the next option button in the tab order in the group and set the option button on, generating a click event. Similarly, the left and up arrow keys move the focus to the prior option button in the tab order in the group and set the value on, generating a click event.

Option buttons (radio buttons) are drawn using the current Windows theme that is in use, unless the currently active JADE skin defines the option button look and feel.

For a summary of the constants, properties, and events defined in the OptionButton class, see "OptionButton Class Constants", "OptionButton Properties", and "OptionButton Events", in the following subsections.