From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from DesktopUIControl)

New in 2021r3

Displays a group of radio buttons.

Closing FocusLost MouseExit
ConstructContextualMenu FocusReceived MouseMove
ContextualMenuItemSelected KeyDown MouseUp
DragEnter KeyUp MouseWheel
DragExit MouseDown Opening
DragOver MouseDrag SelectionChanged
DropObject MouseEnter
Active fa-lock-32.png Index fa-lock-32.png Parent
AllowAutoDeactivate InitialValue fa-lock-32.png Scope fa-lock-32.png
AllowTabStop Italic SelectedIndex
Bold Left TabIndex
Enabled LockBottom Tooltip
FontName LockLeft Top
FontSize LockRight Transparent
FontUnit LockTop Underline
Handle fa-lock-32.png MouseCursor Visible
Height Name fa-lock-32.png Width
Horizontal PanelIndex Window fa-lock-32.png
AcceptFileDrop AddAt Refresh
AcceptPictureDrop Close RemoveAll
AcceptRawDataDrop Count RemoveAt
AcceptTextDrop DrawInto SelectedItem
Add ItemAt SetFocus


Sample Code

This code in the Opening event handler populates a radio group and sets the initial value to the current month:

Var months() As String = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
For Each m As String In months
Var rb As New DesktopRadioButton(m)

Var d As New DateTime
Me.SelectedIndex = d.Month - 1 // Select current month

Examine the value of SelectedIndex in the SelectionChanged event handler to determine which item was selected.

This code adds an item to PopupMenu:

RadioGroup1.Add(new DesktopRadioButton("October"))

This code populates the RowTag identifier with a sequence number:

For i As Integer = 0 To Me.Count - 1
Me.ItemAt(i).Tag = i

Since Tag is a Variant, you must first convert it to an Integer if you want to compare it to another integer. Do this with a simple assignment statement such as:

Var recID As Integer
recID = RadioGroup1.ItemAt(1).Tag

Then compare recID to another Integer.

Changing the selected item in a RadioGroup:

RadioGroup1.SelectedIndex = 3 // Selects the 4th radio button in the group

Displaying the RowTag of the selected menu item:

TexField1.Value = RadioGroup1.ItemAt(RadioGroup1.SelectedIndex).Tag

See Also

DesktopRadioButton control; DesktopUIControl class.