B4J Question how to read TAG from B4XFloatTextField

Gianni M

Well-Known Member
Licensed User
Longtime User
hello,
with this little example, i have a pane with 3 B4XFloatTextField;
i can read a Text Value, but how to get a Tag ?
Tag is set on Visual Designer
 

Attachments

  • helpMe.zip
    2.4 KB · Views: 93

Alexander Stolte

Expert
Licensed User
Longtime User
custom views must be treated differently than native views, here is an important article about it:

This is the code you need:
B4X:
For Each tf As B4XView In Pane1.GetAllViewsRecursive
        If tf.Tag Is B4XFloatTextField Then
            Log(tf.Tag.As(B4XFloatTextField).Text)
            Log(tf.Tag.As(B4XFloatTextField).Tag)
        End If
    Next

But you can also do it this way:
B4X:
    For Each tf As B4XView In Pane1.GetAllViewsRecursive
        If tf.Tag Is B4XFloatTextField Then
            Dim xftf As B4XFloatTextField = tf.Tag
            Log(xftf.Text)
            Log(xftf.Tag)
        End If
    Next
 
Upvote 1
Top