I tried he draggable view class and it works fine as is. However I have an unknown number of labels to be created so I use them in a loop and utilise the sender method to access each label. However I am unable to get it working with out dim'ing them in advance. Is there a way around this? Also is it possible to use the same mathod with icons or pictures?
B4X:
For x = 0 To t
dbCursor.Position = x
Played(x) = dbCursor.GetInt("Played")
Dim lblTeam As DraggableView
lblTeam.Initialize(Activity, lblTeam)
lblTeam.Text=dbCursor.GetString("TeamName")
lblTeam.TextColor=Colors.Black
lblTeam.Tag=dbCursor.GetInt("TeamIndex")
If x Mod 2 = 0 Then
lblTeam.Color=Colors.Yellow
Activity.AddView(lblTeam,1%x,Top,165dip,40dip)
Else
lblTeam.Color=Colors.White
Activity.AddView(lblTeam,51%x,Top,165dip,40dip)
Top=Top + 60dip
End If
Next
Thanks for the reply, No i had not tried that. I thought that only applied to views already created. Is that not so?
Also how would this be different than a for next loop doing exactly the same thing? Am I missing something here?
I However I am unable to get it working with out dim'ing them in advance. Is there a way around this? Also is it possible to use the same mathod with icons or pictures?