I've looked at other posts on here and my code is similar, so I don't know why it doesn't work.
I create a panel array in Sub Globals, the later when trying to work with the array a compile error is produced:
What I need to achieve is to have an array or list of Panels. If this array was called panelList for example, I want to be able to access it like:
panelList(1).Visible = False
panelList(2).Enabled = True
... etc
I've tried lots of ways but can't get it to work!
B4X:
Sub Globals
...
Private targetList(10) As Panel
End Sub
Sub generateTargetMatrix(noOfTargets As Int)
...
Dim targetCounter As Int
targetCounter = 1
For y = 1 To rowCount
For x = 1 To rowCount
targetList.(targetCounter).Initialize("targetMulti") <<<< ERROR line 356
targetList.(targetCounter).Color = Colors.ARGB(255,102,102,102)
targetList.(targetCounter).Enabled = False
targetList.(targetCounter).Elevation = 10dip
pnlGame.AddView(targetList.(targetCounter), (x * gutterWidth) + ((x - 1) * targetWidth), offsetTop + ((y - 1) * (targetWidth + gutterWidth)), targetWidth, targetWidth)
targetCounter = targetCounter + 1
Next
Next
End Sub
I create a panel array in Sub Globals, the later when trying to work with the array a compile error is produced:
B4X:
Error description: Only 'Length' is supported by arrays.
Occurred on line: 356
What I need to achieve is to have an array or list of Panels. If this array was called panelList for example, I want to be able to access it like:
panelList(1).Visible = False
panelList(2).Enabled = True
... etc
I've tried lots of ways but can't get it to work!