Android Question Custom View Object is Stored in Base Panel Tag. Can the Tag Have more than the Object Name

Mahares

Expert
Licensed User
Longtime User
For custom views and specifically XUI views in this case, the object is stored in the tag property of the base panel. Example:
Dim b4xiv As B4XImageView = pnl.GetView(1).Tag
Can I store an additional item in that tag and separate it from the object name. Hopefully, I am wording this inquiry correctly.
thank you
 

DonManfred

Expert
Licensed User
Longtime User
As the CustomView is basically a Class; couldn´t you just create a Second Property MyTag in your Class to store whatever you want?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Generally a customview already has a tag property (not the mbase.tag) which is initially populated from the tag added to the designer (there may be some legacy customviews where this is not the case). This is available for general use.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Generally a customview already has a tag property
Dim myView as Object = B4XImageView .Tag
Steve: What I ended up doing is using the tip provided by @Filippo and applied it to a code snippet similar to the below and it pretty much was what I was looking for:
B4X:
Dim b4xiv As B4XImageView = pnl.GetView(1).Tag 
Dim MyTag As String= b4xiv.Tag
If MyTag="myimage" Then
        l.Color=xui.Color_Magenta  'l is a label having the name of the image
End If
 
Upvote 0
Top