UserGuide

Desktop Radio Button Group

From Xojo Documentation

Revision as of 17:37, 17 September 2021 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Radio Button Library Icon

Radio Buttons are used to present the user with two or more choices, where only one of the choices can be selected. Selecting one Radio Button causes the Radio Button that is currently selected to become unselected. They are called Radio Buttons because they act just like the row of buttons for changing radio stations on car radios where pushing one button deselects the current radio station and selects the new station. Because a single radio button does not make sense, the DesktopRadioGroup control defaults to two Radio Buttons though you can add more.

Refer to DesktopRadioGroup in the Language Reference for details on all its events, properties and methods.

Below are the commonly used events and properties.

Events

SelectionChanged - Called when a Radio Button in the group is selected.

Properties

SelectedItem - This provides the DesktopRadioButton that is selected allowing you to manipulate it.

SelectedIndex - The index of the selected Radio Button.

Handling Focus

On Windows, a radio button whose Value is True can get the focus when you tab through the controls. Once a radio button has the focus, the arrow keys can be used to move to other radio buttons, changing the selection.

Usage

In the SelectionChanged event handler, you will put the code that should run when the button is selected.

You can also select a Radio Button in your code via the SelectedIndex property. Doing so will deselect the already selected Radio Button in the group.

MyRadioGroup.SelectedIndex = 5

See Also

DesktopRadioButton class