Android Question View array in abstract designer.

Beja

Expert
Licensed User
Longtime User
Hello friends,

I am trying to create array of labels in the abstract designer (not in code).. in VB I used to just
give them the same name and VB creates the indexes, after asking you for confirmation the first time
you give the same name to the second control.
How can I do that in B4A.

Thanks in advance.
 

DonManfred

Expert
Licensed User
Longtime User
I dont understand what exactly you want to do but i think you have to do that by code if you want to get an array of labels. In Designer each view has its own unique name.

but in code you can create a array of labels and place them by code.

If thats not what you want then please explain more details what you want to do
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks Manfred, and yes I want to create an array of labels.. I already placed the labels on a panel
in designer and as you said, designer didn't give me the chance to give them the same name.
Now what shall I do? can I draw the labels in designer and create their names in code?
I have many other views in designer so I can't mix designer and code (I think).
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can mix designer views with "code" views.

There are several ways in which you can easily build an array of views from views created with the designer.

If all these labels belong to the same panel and there are no other views in this panel then you can do something like:
B4X:
Dim labels(Panel1.NumberOfViews) As Label
For i = 0 To Panel1.NumberOfViews - 1
 labels(i) = Panel1.GetView(i)
Next

There are other ways as well to build such an array (or List).
 
Upvote 0
Top