The code below is an example for single or double clicking on a view, e.g. ImageView.
Pretty good code. You can be sure that clicking will execute only one selected group of code.
And here is the effect:
Pretty good code. You can be sure that clicking will execute only one selected group of code.
Example::
Sub Process_Globals | Sub Class_Globals
Private ClickIndex As Int
End Sub
Private Sub showPhoto_MouseClicked (EventData As MouseEvent)
' Dim tagIV As ImageView = Sender 'if required in the project, set it at the beginning!
ClickIndex = ClickIndex + 1
If EventData.ClickCount > 2 Then Return
If EventData.ClickCount = 1 Then
Dim MyIndex As Int = ClickIndex
Sleep(250) 'You need to work out the time for the correct reaction of the mouse (>=250 ms)
If MyIndex <> ClickIndex Then Return
End If
If EventData.ClickCount > 1 Then ' Double-click;
' Select tagIV.Tag.As(Int)
' Case 1
' showPhotoNo1.SetImage(...)
' Case Else
' showPhotoNo4.SetImage(...)
' End Select
... code block ...
Else ' Single-click;
... code block ...
End If
End Sub
And here is the effect: