B4J Question Pick a BBCodeView from a panel

rbirago

Active Member
Licensed User
Longtime User
To pick a standard view from a panel is simple using a panel.GetAllViewsRecursive and checking the tag, but if the view is a Custom View? For example if in the panel there is a BBCodeView it seems that GetAllViewsRecursive doesn't browse the BBCodeView. Am I wrong? Is there a way to browse (and check) all the objects of the panel including the custom views?
 

stevel05

Expert
Licensed User
Longtime User
Yes you are wrong, the BBCodeView is the same as other custom views in that the class object is stored in the Panes Tag.

Try this on the pane that you have a BBCodeView. Change {Pane} you the name of the pane that you have the bbcodeView on.

B4X:
For Each V As B4XView In {Pane}.GetAllViewsRecursive
        Log(GetType(V.Tag))
        Log( V.tag Is BBCodeView)
    Next

I'm not quite sure why you would want to browse the pane for it though. It is usually easier to use a global variable to access it directly.
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
yes: I am wrong and you are right. Really my problem was this: usually when I browse the views of a panel I use tag to recognize a specific view. Also in this case I have forced in BBCodeView's tag a string by designer. The trick is that BBCodeView overwrites tag using it to carry other view infos (you can verify this looking at the attached example in which I have added your suggestions).
The reason for what I browse the pane is that I have to verify the content of the BBCodeView I have in any CustomListView element.
So, first of all: thank you. Then: if the tag of BBCodeView is used for internal reasons it means that in BBCodeView the user cannot use tag for his purposes?
 

Attachments

  • ExtractBBCodeView.zip
    421.7 KB · Views: 134
Upvote 0

stevel05

Expert
Licensed User
Longtime User
On more recent b4xLibs, the tag added in the designer is moved to the tag property of the custom view class. It hasn't been done for this view yet. Perhaps if you add it as a wish Erel might implement it in the next release.
 
Upvote 0
Top