Sorry, repost better expl. partial array as Rect

enonod

Well-Known Member
Licensed User
Longtime User
Sorry for reposting, I made a mess previously.
The following shows, I think, what I am trying to do with a single array, not two and also shows where the error is because that part of the array is not dim'd as Rect. How do I do that? I thought I could have a mixed array rather than aThings(6,6,2) as Rect; all the same

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim cvsGrid As Canvas
   Dim col,row,kWH=20dip As Int
   Dim aThings(6,6,2)    '0=Rect; 1=colour; 2=?? later
   cvsGrid.Initialize(Activity)
   For row=0 To 5
      For col=0 To 5 'The next line gives error 'initialize', obviously
         aThings(col,row,0).Initialize((col+1)+col*kWH,(row+1)+row*kWH,(col+1)+col*kWH+kWH,(row+1)+row*kWH+kWH)
         aThings(col,row,1)=Colors.Blue
         cvsGrid.DrawRect(aThings(col, row, 0),aThings(col, row, 1),True,1dip)
      Next
   Next
End Sub
 
Last edited:

derez

Expert
Licensed User
Longtime User
Try
B4X:
Type things(rct As Rect, col As Int)
dim aThings(6,6) as things

....

aThings(row,col).rct.initialize(....)
aThings(row,col).col = ...
 
Last edited:
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
I reposted and then got the answer from klaus but on the original post. I therefore did not see your response on the repost later.
So thank you belatedly derez.
 
Upvote 0
Top