From Xojo Documentation
Supported PlatformsProject Types: Web Platforms: macOS, Windows, Linux
- For desktop applications, see RadioButton.
Allows you to add a set of radio buttons to a web page. You can group the buttons in any number of columns and rows.
RadioGroup manages a set of radio buttons, which can be organized by rows and columns. In the IDE, you can edit properties of individual cells by clicking on the "pencil" icon to put the RadioGroup into edit mode. When in edit mode, clicking on individual radio button cells displays their properties in the IDE.
By default, the WebRadioGroup control creates a group with two rows and one column, but this is easily changed via the ColumnCount and RowCount properties in the Behavior group.
To determine which radiobutton was clicked, place code in the SelectionChanged event. This event is analogous to the Action event of a RadioButton. See the example for the SelectionChanged event or the examples in the SelectedCaption, SelectedCell, and SelectedTag properties.
The SelectedCell method gives you the Row : Column value of the selected cell as a Pair. Row and Column are zero-based. To determine which RadioButton in the control was clicked, test the RadioButtons in the SelectionChanged event handler. See the example in the SelectedCell method.
You can access the individual cells using CellCaption, CellEnabled, CellTag, CellValue, and CellVisible. You can also get the currently selected Caption or Tag in the SelectionChanged event using SelectedCaption or SelectedTag, respectively.
The CellTag is a unique string you can give to each cell to allow you to quickly identify cells, without relying on the caption. It serves the same purpose as a RowTag for a WebListBox and other controls.
When you add a RadioGroup, you can click the "pencil" icon to go into edit mode where you can select the individual radio button cells. When you select a radio button cell, its properties appear in the IDE.
In code, you pass the row and column indexes to these properties to indicate which radio button you are referring to.
See the individual events, properties, and methods for more examples.
The following uses CellCaption to caption a new radio button.
This code disables the cell.
This code selects a radio button, which has the effect of unchecking all the other radio buttons in the group:
This code hides the specified radiobutton.
Use SelectedCell in the SelectionChanged event handler to determine which radio button was clicked. Since SelectedCell is a Pair, the Left property represents the row index and the right property is the column index. The indexes are zero-based.
The default WebRadioGroup has two rows and one column. To determine which radio button was clicked, simply test the Row index. For example:
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.")