I imagine this is something simple, but the routine below should draw 40 boxes, however it only draws the first box. I know it is looping more than once because variable i increments to 40 in the log.
This code is based on sample given to me by NJDude.
This code is based on sample given to me by NJDude.
B4X:
Sub CheckerboardFade As ResumableSub
Dim ivTop As Int = ivStartCustomer.Top
Dim ivLeft As Int = ivStartCustomer.Left
Dim ivWidth As Int = ivStartCustomer.Width
Dim ivHeight As Int = ivStartCustomer.Height
Dim lBox(100) As Label ' Why 100? If I use Dim lbox() as Label I get index out of range error below
Dim i,x,y As Int
i = 0
For x = 0 To ivWidth Step 50
For y = 0 To ivHeight Step 50
i = i + 1
lBox(i).Initialize("lBox")
lBox(i).Visible = True
lBox(i).Color = Colors.White
lBox(i).Width = 50dip
lBox(i).Height = 50dip
lBox(i).TextColor = Colors.Black
lBox(i).Text = i ' This is for testing. Background of label should be enough to draw box
Activity.AddView(lBox(i),ivLeft+(x * lBox(i).Width),ivTop + (y * lBox(i).Height),lBox(i).Width,lBox(i).Height)
lBox(i).BringToFront
Log( i & " " & x & " " & y)
Sleep(50)
Next
Next
Return 0
End Sub