Android Question View and B4XView

Sergey_New

Well-Known Member
Licensed User
Longtime User
The panel contains several elements.
To change their properties I do:
B4X:
For i = 0 To pn.NumberOfViews - 1
    Dim v As View=pn.GetView(i)
    If pn.GetView(i) Is EditText Then
        Dim et As EditText=v
        et.TextSize=Starter.TextSize
    Else If pn.GetView(i) Is Spinner Then
        Dim sp As Spinner=v
        sp.TextSize=Starter.TextSize
    End
Next
I decided to replace Spinner with B4XComboBox
How can I add B4XComboBox to this function?
 

stevel05

Expert
Licensed User
Longtime User
For B4x customviews, the actual object is stored in the base panel's Tag property. So you can test for it in the views Tag.

Edit: See Erel's link

The B4xCombobox also exposes the underlying combobox as cmbBox, so you can directly change it's properties.

B4X:
    For i = 0 To Pn.NumberOfViews - 1
        Dim v As B4XView = Pn.GetView(i)
        If V Is EditText Then
            V.TextSize=TextSize
        Else If V Is Spinner Then
            Dim Sp As Spinner = V
            Sp.TextSize = TextSize
        Else If v.Tag Is B4XComboBox Then
            Dim cb As B4XComboBox = v.Tag
            cb.cmbBox.TextSize = TextSize
        End If
    Next
 
Last edited:
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
stevel05, this code was what I needed:
B4X:
Dim v As B4XView = Pn.GetView(i)
It was not clear how to define B4XView and View elements in the panel.
Thanks!
 
Upvote 0
Top