Hi all,
1st I'd like to say thank you for this very informative forum! I've read a lot here and found many solutions. But I could'nt find one for this problem. Maybe someone has an idea (hopefully).
I have 5 ImageViews inside a Panel which I originally copied from the UserInteraceButtonToolbox sample. To get later access to each one of these ImageViews I thought I could copy them to an array while I initialized them:
Dim btnPage(6) As ImageView
Dim i As Int
Dim h, w, b As Int
pnlToolbox.Width = Activity.Width
w = pnlToolbox.Width / 5
pnlToolbox.Height = w
h = w * .7
b = (w - h) / 2
For Each v As ImageView In pnlToolbox.GetAllViewsRecursive
v.Height = h
v.Width = h
v.Top = b
v.Left = w * (v.Tag - 1) + b
btnPage(v.Tag) = v ' store reference to ImageView in array
Log("T: " & btnPage(v.Tag).Tag)
Next
For i = 1 To 5
Log("t: " & btnPage(i).tag)
Next
While executing this code I get this in the debugging window:
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
T: 1
T: 2
T: 3
T: 4
T: 5
To me this looks as if the array contains all 5 ImageViews. But, while executing this in the same sub
For i = 1 To 5
Log("t: " & btnPage(i).tag)
Next
I get
t: 5
t: 5
t: 5
t: 5
t: 5
** Activity (main) Resume **
** Activity (main) Resume **
And after this all 5 references in the array point to the last inserted ImageView.
What am I doing wrong?