UserGuide

Web Radio Group

From Xojo Documentation

A Radio Group control provides a collection of radio buttons for the user to choose from. It enables you to create a single control that contains a row by column array of radio buttons. The default for a Radio Group is one column and two rows.

In a Web Radio Group control, the number of rows and columns is controlled by the ColumnCount and RowCount properties in the Inspector. Change these properties as necessary and then resize the control so that everything fits properly.

To edit the cells of a Radio Group, use the Set Default Value feature. Once active, you can click on each cell to set its properties (Caption, Enabled, Visible, Tag and Selected).

Web Radio Group Editing

Below are commonly used events, properties and methods. Refer to WebRadioGroup in the Language Reference for the complete list.

Events

SelectionChanged

Called when the radio button selection has changed.

Properties

CellCaption

Use to set the caption for a specific radio button (cell). Supply the row and column as parameters.

CellEnabled

Use to enable or disable a specific radio button (cell).

CellSelected, CellValue

Use to select or deselect a specific radio button (cell).

CellTag

Use to get or set the tag value for a specific radio button (cell).

CellVisible

Use to get or set the visibility of a specific radio button (cell).

ColumnCount

The number of columns in the radio group.

RowCount

The number of rows in the radio group.

Methods

SelectByCaption, SelectByTag

Allows you to select a specific radio button in the Radio Group by specifying its Caption or Tag value.

SelectedCaption

Returns the Caption of the selected radio button.

SelectedCell

Returns the row and column indexes of the selected radio button as a Pair.

SelectedTag

Returns the Tag of the selected radio button.

Usage

Web Radio Group

When you drag a Radio Group control onto a layout, it starts with one column and two rows called "First" and "Second". You can use this code in the SelectionChanged event to determine which radio button is selected by the user:

Var p As Pair

p = Me.SelectedCell
Select Case p.Left
Case 0 // Row 1
MsgBox("You clicked the top button.")
Case 1 // Row 2
MsgBox("You clicked the bottom button.")
End Select

See Also

WebRadioGroup class; UserGuide:Web UI topic