B4J Question CustomListView does not have the Tag property

Filippo

Expert
Licensed User
Longtime User
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
But my project could create 100 elements, each composed of a Pane that contains a CLV. Number of elements variable.
I do not understand the assignment of the Tag property, as in other custom views (which is already quite complicated).
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
It doesn't matter, as it's a test project. Anyway:
why not use xCustomListView1.AsView.Tag?
https://www.b4x.com/android/forum/t...-it-was-generated-dynamically.133287/#content

In the project I would have many Panes in each of which a CLV, all created dynamically.
How to get one of the CLVs starting from the Pane that contains it?
Look at the answer that Erel gave you and imagine having 100 Panes and therefore 100 CLVs.

I read (if I'm not mistaken) that unlike many other B4X custom views, Erel has not implemented the usual way of managing the two Tags for backward compatibility. Maybe it would be the case to do it and make the previous version obsolete.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
many Panes in each of which a CLV, all created dynamically
You at any way have to iterate all dynamically created views first, despite tag or any other their properties...
But adding a new "tag" property into any existing view - seems, not a trouble, as a new version.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You at any way have to iterate all dynamically created views, despite tag or any other their properties...
That's exactly the problem: recognizing and obtaining the reference to a CLV by recursively analyzing the views of a Pane.
B4X:
For Each xView As B4XView In Pane1.GetAllViewsRecursive
    'Get the CLV here, without the usual way of the two tags in custom views.
Next
As Erel suggested in that thread, you need to have a declared CLV of support at the class level, but what if you have 100 Panes + 100 CLVs?
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
iterating
So, what will be the code if not

B4X:
For Each xView1 As B4XView In Pane1.GetAllViewsRecursive
    'Get the CLV here, without the usual way of the two tags in custom views.
    For Each xView2 As B4XView In xView1.GetAllViewsRecursive
        'Get the CLV here, without the usual way of the two tags in custom views.
        For Each xView3 As B4XView In xView2.GetAllViewsRecursive
            'Get the CLV here, without the usual way of the two tags in custom views.
            log(xView3.AsView.SuperDuperTag)
        Next
    Next
Next

?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Anyway, I'm just surprised that CLV doesn't have the Tag property (it would be better if it was like all B4X custom views).
If I remember correctly CLV was created before the B4x Framework and the adoption of the standardization of the Tag field in B4xCustomViews. It was probably not added as it would have broken existing code.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
If I remember correctly CLV was created before the B4x Framework and the adoption of the standardization of the Tag field in B4xCustomViews. It was probably not added as it would have broken existing code.
Erel could create CustomListView2, with the tag and some additional features (e.g. those of the current extension classes).
 
Upvote 0
Top