where is the difference ?

madru

Active Member
Licensed User
Longtime User
Hi,

can somebody please explain why this does work:

B4X:
NbCols=3
   For r = 0 To 0  '<----------?????????
      For c = 0 To NbCols -1
         j = r * NbCols + c
         Dim pnl As Panel
         titles.Add("Title" & j)
         pnl.Initialize("pnl")
         j=r*RowHeight
         scvTest.Panel.AddView(pnl, c * ColWidth, r * RowHeight, ColWidth, RowHeight)
         pnl.Tag = j
         pnl.Color = Colors.Transparent
         Dim bmp As Bitmap
         bmp.Initialize(File.DirAssets, RemotePicture(j))
         Dim cvs As Canvas
         cvs.Initialize(pnl)
         cvs.DrawBitmap(bmp, Null, ImageRect)
      Next
   Next

and this not?

B4X:
r=0
NbCols=3
      For c = 0 To NbCols -1
         j = r * NbCols + c
         Dim pnl As Panel
         titles.Add("Title" & j)
         pnl.Initialize("pnl")
         j=r*RowHeight
         scvTest.Panel.AddView(pnl, c * ColWidth, r * RowHeight, ColWidth, RowHeight)
         pnl.Tag = j
         pnl.Color = Colors.Transparent
         Dim bmp As Bitmap
         bmp.Initialize(File.DirAssets, RemotePicture(j))
         Dim cvs As Canvas
         cvs.Initialize(pnl)
         cvs.DrawBitmap(bmp, Null, ImageRect)
      Next


THX
 

madru

Active Member
Licensed User
Longtime User
1st version shows Panel and Bitmaps, 2nd not

a 0 to 0 loop should be the same as 0 ;)
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
0 to 0 will loop through once

regards Ricky
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
For me there is no reason that the second code doesn't work.
You should post the whole code, I suspect that the problem is somewhere else.

I don't understand this code:
B4X:
j = r * RowHeight
.
pnl.Tag = j
j is 0 for all views in the row and if r > 0 the Tag is proportional to the RowHeight ?

Best regards.
 
Upvote 0
Top