B4J Question How to know if B4XView is label, pane or button

Good afternoon everyone. Is there any pre-defined method to know if a B4XView is a label, a button or a panel? I intend to interact on all panels, and I'm using the hack to assign value to the respective Tags, so that I can then identify them. Is there any other way to get the same result? Thank you for your help
 

PaulMeuris

Well-Known Member
Licensed User
In this code i am using the GetAllViewsRecursive method of the board panel (from a board game) to get to the specific panel on the row and column position.
The syntax for testing a view type is with the test "B4Xview IS Pane" (or Label or Button...)
get a panel:
Private Sub get_panel(pnlrowcol As String, pnboard As Pane) As Pane
    For Each v As B4XView In pnboard.GetAllViewsRecursive
        If v Is Pane Then
            If v.Tag = pnlrowcol Then
                Return v
            End If
        End If
    Next
    Return Null
End Sub
 
Upvote 0
Hello and thanks for the help.
Now that I can identify objects of a certain type without using the respective tags, how can I specifically identify a certain object (again, without using Tags)? If I remember correctly in java the resource to HasCode helps in this purpose. Is there something similar in B4X ? Maybe resorting to inline java ?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Now that I can identify objects of a certain type without using the respective tags, how can I specifically identify a certain object (again, without using Tags)? If I remember correctly in java the resource to HasCode helps in this purpose. Is there something similar in B4X ? Maybe resorting to inline java ?
If I guess is correct. you meant that is hashcode. In B4X it is Map type
 
Upvote 0
Top