Sub Globals
Dim lblTest As Label
Dim reflect As Reflector
End Sub
Sub Activity_Create(FirstTime As Boolean)
'**create first label
lblTest.Initialize("lblTest")
lblTest.Color = Colors.Blue
lblTest.Text = "Test1"
lblTest.Tag = "1"
Activity.AddView(lblTest, 10dip, 10dip, 200dip, 100dip)
'**create second label (only this lable triggers the touch event)
lblTest.Initialize("lblTest")
lblTest.Color = Colors.red
lblTest.Text = "Test2"
lblTest.Tag = "2"
Activity.AddView(lblTest, 10dip, 150dip, 200dip, 100dip)
'**create more labeles (in for/next loop)
'....
reflect.Target = lblTest
reflect.SetOnTouchListener("lblTest_Touch")
End Sub
Sub lblTest_Touch(lblTest1 As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
'*try to find out which label has triggered this event : Result: only the second label triggers this event
Log("lblTest1 Object= "& lblTest1)
Dim myLabel As Label
myLabel = Sender
Log("sender.tag= "& myLabel.tag)
'*************************************
Select Action
Case Activity.ACTION_DOWN
'do something here..
ase Activity.ACTION_MOVE
'do something here..
Case Activity.ACTION_UP
'do something here..
Return True
End Sub