'Justifies the full-width controls (based on text labels) evenly to the left
'Parameters: Panel, Starting indent, Minimum gap between controls
Private Sub PackControlsLeft (DesignerArgs As DesignerArgs)
Dim Panel As B4XView = DesignerArgs.GetViewFromArgs(0)
If Panel.IsInitialized = False Then Return
Dim startX As Int = DesignerArgs.Arguments.Get(1)
Dim Gap As Int = DesignerArgs.Arguments.Get(2)
For i = 0 To Panel.NumberOfViews - 1
Dim v As B4XView = Panel.GetView(i)
If V Is Pane Then
If V.tag Is B4XRadioButton Then 'Identifies the customviews type
Log("Found")
Dim Lbl As B4XView = v.GetView(1) 'Get the label from the Custom view
Dim Offset As Int = Lbl.Left 'Get it's left position so we know how wide the indicator is
Dim tw As Int = MeasureTextWidth(Lbl) + 10 'Add 10 to allow for the labels padding. Could probably find the exact value if needed
'Adjust the layout of the Custom views base
v.SetLayoutAnimated(0, startX, V.Top, tw + Offset, V.Height)
'Adjust the layout of the label
Lbl.SetLayoutAnimated(0, Offset, 0, tw, Lbl.Height)
startX = startX + tw + Gap + Offset
End If
End If
Next
End Sub