B4J Question [B4X] Problem with B4XView iteration of (UI) components

CryoGenID

Active Member
Licensed User
Longtime User
Dear fellow developers,

I have a problem and hope that you can help me :)

I am trying to interate through all UI components in my current view and change some settings (e.g. colors).
It works great with Buttons and Labels in B4J and B4i (B4A not tested yet) but I also have a B4XFloatTextField and that is not being recognized by my "else if" clause...
(What) would I need to do different that I can check if the current B4XView (variable "v" in my example) is a B4XFloatTextField and do my changes?

For j = 0 To b4xviewIn.NumberOfViews-1
Dim v As B4XView = b4xviewIn.GetView(j)
If v Is Button Then
v.Text = "TestButton"
Else if v Is Label Then
v.Text = "TestLabel"
Else if v Is B4XFloatTextField Then
v.EditTextHint = "TestB4XFloatTextField"
End If
Next

Thanks so much in advance!

Best regards,

Chris
 
Solution
Thanks Luca for your reply!

That worked beautifully! :)
THANKS!

One question though:
Do I need to get the types of the B4X.... - components always via the tag-attribute?

Thanks and best regards,

Chris

LucaMs

Expert
Licensed User
Longtime User
B4X:
    For j = 0 To b4xviewIn.NumberOfViews-1
        Dim v As B4XView = b4xviewIn.GetView(j)
        If v Is Button Then
            v.Text = "TestButton"
        Else if v Is Label Then
            v.Text = "TestLabel"
        Else if v.Tag Is B4XFloatTextField Then
            Dim FTF As B4XFloatTextField = v.Tag
            FTF.HintText = "TestB4XFloatTextField"
            FTF.Update
        End If
    Next
 
Upvote 1

CryoGenID

Active Member
Licensed User
Longtime User
Thanks Luca for your reply!

That worked beautifully! :)
THANKS!

One question though:
Do I need to get the types of the B4X.... - components always via the tag-attribute?

Thanks and best regards,

Chris
 
Upvote 0
Solution
Top