Values have been saved in the Label.Tag in the Click sub.
When I Click the Label I do not get the original values back from snd.Tag.
It seems clear that it is occuring because of the change to 'lPos' in the Tick sub, because the new Tag values match that.
I cannot see why changing the values of 'lPos' in the Tick Sub is changing snd.Tag
What have I done wrong or what don't I know please?
When I Click the Label I do not get the original values back from snd.Tag.
It seems clear that it is occuring because of the change to 'lPos' in the Tick sub, because the new Tag values match that.
I cannot see why changing the values of 'lPos' in the Tick Sub is changing snd.Tag
What have I done wrong or what don't I know please?
B4X:
Sub Process Globals
Type Tagg(C As Byte, R As Byte, colour As Int)
End Sub
Sub Globals
Dim lPos As Tagg
Dim snd as Label
End Sub
Sub live(c,r As Byte, sEvent As String)
Dim bx As Label
Dim lTag As Tagg
bx.Initialize(sEvent)
lTag.c=c : lTag.r=r
lTag.colour=aColours(Rnd(1,6))
bx.Tag=lTag
bx.Color=lTag.colour
pnl.AddView(bx, ...,...,...)
...
End Sub
Sub Bx_Click
snd=Sender : lPos=snd.Tag
col=lPos.C : row=lPos.R
dirC=0 : dirR=1
...
End Sub
Sub Ticker_Tick
...
lPos.C = lPos.C + dirC*-1 : lPos.R = lPos.R + dirR*-1
...
End Sub
Last edited: