In this link below @ https://www.b4x.com/android/forum/t...odeview-and-b4xradiobutton.147245/post-933746
Erel was able to solve b4xradiobutton height challenge. It was cool and worked well when there is no other control on bbcodeview at designer. However, when there are more controls on bbcodeview as indicated in the image below in the designer.
The code is giving error only on two heighighted statements in the code's Getview(0) as shown in the code below
I tried using v.Getview(0).Getview(1).tag and used recurrssive approach, but coudn't get it resolve. How can that segment of code be rewritten based on designer view tree above for BBCodeView3 so that my b4xradiobutton can work properly ?
Erel was able to solve b4xradiobutton height challenge. It was cool and worked well when there is no other control on bbcodeview at designer. However, when there are more controls on bbcodeview as indicated in the image below in the designer.
The code is giving error only on two heighighted statements in the code's Getview(0) as shown in the code below
B4X:
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
I tried using v.Getview(0).Getview(1).tag and used recurrssive approach, but coudn't get it resolve. How can that segment of code be rewritten based on designer view tree above for BBCodeView3 so that my b4xradiobutton can work properly ?
Last edited: