In the early stages of writing a program, I create 42 Labels using Activity.AddView. They are linked to a single sub and I can identify the label clicked by accessing the tag. My question is, how can I distinguish between long click and short clicks? Here is the relevant code so far:
Sub Activity_Create(FirstTime AsBoolean)
activity.LoadLayout("Temp2")
LS = 45
For i=1To7
For j=1To6
X1 = i + 7*(j-1)
X2 = (LS+1)*(j-1)
X3 = (LS+1)*(i-1)
Activity.AddView(LabelCreator("Label" & X1),X3,X2,LS,LS)
Next'j
Next'i
End Sub
Sub LabelCreator (Text AsString) AsLabel
Dim b AsLabel
b.Initialize("CatchLabel")
b.Text = Text
b.Tag = Text
b.Color = Colors.White
Return b
End Sub
Sub CatchLabel_click
Dim v AsView
v = Sender
ToastMessageShow(v.Tag, True)
End Sub
Sub Activity_Create(FirstTime AsBoolean)
activity.LoadLayout("Temp2")
LS = 45
For i=1To7
For j=1To6
X1 = i + 7*(j-1)
X2 = (LS+1)*(j-1)
X3 = (LS+1)*(i-1)
Activity.AddView(LabelCreator("Label" & X1),X3,X2,LS,LS)
Next'j
Next'i
End Sub
Sub LabelCreator (Text AsString) AsLabel
Dim b AsLabel
b.Initialize("CatchLabel")
b.Text = Text
b.Tag = Text
b.Color = Colors.White
Return b
End Sub
Sub CatchLabel_click
Dim v AsView
v = Sender
ToastMessageShow(v.Tag, True)
End Sub