Android Question Views and Loops Tutorial

pauleffect

Member
Licensed User
Longtime User
Guys, i have a newbie question.

If I have something like
(
B4X:
(...)
For i = 0 to 666
Dim cW as panel
cw.Initialize
Desiredview.Panel.AddView(parameters, go, here)
Next
(...)

If I have to work with those panels again, how do I do that?
I mean call something like cW(2) the third panel.
Thanks.
 

stevel05

Expert
Licensed User
Longtime User
You'd need to maintain an index array such as:
B4X:
Dim Panels(667) As Panel
For i = 0 to 666
    Dim cw as Panel
    cw.Initialize("")
    Panels(i) = cw
    Desiredview.Panel.AddView(cw,Left,Top,Width,Height)
Next

The you can access them as:

B4X:
Panels(2)
 
Last edited:
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Guys, i have a newbie question.

If I have something like ...
I mean call something like cW(2) the third panel.
Thanks.

B4X:
(...)
Dim cwList as List

cwList.initialize

For i = 0 to 666
  Dim cW as panel
  cw.Initialize
  cwList.Add(cW)
  Desiredview.Panel.AddView(cW, other, parameters, go, here)
Next
(...)

I would create a list to hold each instance of CW. For some reason I like to use lists. :)

Barry.
 
Upvote 0
Top