Android Question Working with LoadLayout and Array

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have:

Dim Panels(30) as Panel

Then I do a loop:

for i = 0 to 29
Panels(i).Initialize("")
Panels(i).LoadLayout("1.bal")

... access directly the Labels and other objects from the LoadLayout before the next loop

Next

Inside this Layout there are labels and customgridview

The thing is, how can access AGAIN like the Panels(10) ? I want to change ou interact with the CustomGridView that is part of that Panels(10)

Thanks
 

fixit30

Active Member
Licensed User
Longtime User
Make Panels(30) asPanel a global variable.

Then later you can:

B4X:
Dim pnl as Panel = panels (10)
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
So, getting the panel from the array, does not bring me back the children of the panel that are the CustomListView and other labels

I want to interact with this CustomListView
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Please use [code]code here...[/code] tags when posting code.

CustomListView instances are not views. You will not find them by calling Panel.GetAllViewsRecursive. You will only find the ScrollView that is added.
One simple solution is to use the Tag property to store a reference to the CustomListView:
B4X:
Panels(i).LoadLayout(...)
Panels(i).Tag = CustomListView1

If you need to store multiple CLVs then use a custom type.

I recommend you to use a List instead of an array. It is more flexible.
 
Upvote 0
Top