Android Question Forms Builder B4XPreferencesDialog Question

Diceman

Active Member
Licensed User
I'm looking at the code for https://www.b4x.com/android/forum/t...der-designer-for-b4xpreferencesdialog.104670/ FormsBuilder.b4j (version 1.66 ) and I'm trying to understand the following code:

B4X:
Sub AddItem (m As Map)
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, list.AsView.Width, 145dip)
    pnl.LoadLayout("Item")                                                    'pnl is loaded with views
    Dim title As B4XFloatTextField = pnl.GetView(TitleIndex).Tag              'Why is it assigning TAG to B4XFloatTextField?
    Dim options As B4XFloatTextField = pnl.GetView(OptionsIndex).Tag          'Why is it assigning TAG to B4xFloatTextField?
    Dim cmb As ComboBox = pnl.GetView(TypesIndex)
    Dim Key As B4XFloatTextField = pnl.GetView(KeyIndex).Tag                  'Why is it assigning TAG to B4XFloatTextField?
    Dim switch As B4XSwitch = pnl.GetView(RequiredIndex).Tag                  'Why is it assigning TAG to B4XSwitch?
  ...

I don't understand why the commented statements above are assigning the view's Tag to the B4XFloatTextField and B4XSwitch. The tag in the layout is Null. Why isn't it like this:
B4X:
Sub AddItem (m As Map)
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, list.AsView.Width, 145dip)
    pnl.LoadLayout("Item")                                                     'pnl is loaded with views
    Dim title As B4XFloatTextField = pnl.GetView(TitleIndex)            
    Dim options As B4XFloatTextField = pnl.GetView(OptionsIndex)
    Dim cmb As ComboBox = pnl.GetView(TypesIndex)
    Dim Key As B4XFloatTextField = pnl.GetView(KeyIndex)
    Dim switch As B4XSwitch = pnl.GetView(RequiredIndex)
  ...

Can anyone shed some light on this?
TIA
 
Top