Private Sub CreateRB (GroupKey As String) As String
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0, 0, 0, 30dip, 30dip) '40
pnl.LoadLayout("RadioButton")
Dim name As String = ("rb" & BBCodeView3.Views.Size)
Dim rb As B4XRadioButton = pnl.GetView(0).Tag
RadioButtonGroups.Put(rb, GroupKey)
BBCodeView3.Views.Put(name, pnl)
Return $"[View=${name} Vertical=10/]"$
End Sub
Private Sub B4XRadioButton1_Checked
Dim CheckedRB As B4XRadioButton = Sender
Dim CurrentGroup As String = RadioButtonGroups.Get(CheckedRB)
Log("current group: " & CurrentGroup)
'Log("CheckedRB1: " & CheckedRB)
For Each v As B4XView In BBCodeView3.Views.Values
If v.GetView(0).Tag Is B4XRadioButton Then
Dim rb As B4XRadioButton = v.GetView(0).Tag
If rb <> CheckedRB And RadioButtonGroups.Get(rb) = CurrentGroup Then
Log("You clicked: " & v.GetView(0).Tag)
rb.Checked = False
End If
End If
Next
End sub