is there a way to handle these two events in a control, MouseDown and DoubleClick ?
I get always the handler of MouseDown, and never of DoubleClick
I should manage the DoubleClick to get a double-tap…
is there a way to handle these two events in a control, MouseDown and DoubleClick ?
I get always the handler of MouseDown, and never of DoubleClick
I should manage the DoubleClick to get a double-tap…
[quote=201713:@Marc Couraud]is there a way to handle these two events in a control, MouseDown and DoubleClick ?
I get always the handler of MouseDown, and never of DoubleClick
I should manage the DoubleClick to get a double-tap…[/quote]
In MouseDown, you can time how long since the previous click/tap, and if it is less than half a second, then it is double click. A static variable set to Ticks, which you look at when you enter the MouseDown would do ; if Ticks-OldTicks <= 30 then
doubleclick.
yes, I can…
but in Xojo desktop, the two events are correctly raised by xojo
thanks Michel
[quote=201715:@Marc Couraud]yes, I can…
but in Xojo desktop, the two events are correctly raised by xojo
thanks Michel[/quote]
There are things that do not behave quite the same in each platform. I was just trying to offer a solution.
[quote=201713:@Marc Couraud]is there a way to handle these two events in a control, MouseDown and DoubleClick ?
I get always the handler of MouseDown, and never of DoubleClick
I should manage the DoubleClick to get a double-tap…[/quote]
From what I see here on Mac and Windows, WebPage DoubleClick fires after two MouseDown. So both events do fire, the problem being to discriminate.
I know you believe it should work as in Desktop. Maybe you should file a bug report. Until it is fixed, though, the only way to distinguish them will be a workaround. Incidentally, your question was :
[quote]]is there a way to handle these two events in a control, MouseDown and DoubleClick ?[/quote]. It did not say anything about Xojo Desktop.
I proposed a first workaround above, here is a second one.
Sub Action()
System.DebugLog "MouseDown"
me.enabled = False
End Sub
Sub MouseDown(X As Integer, Y As Integer, Details As REALbasic.MouseEvent)
ouseDownTimer.Enabled = False
MouseDownTimer.Period = 500
MouseDownTimer.Mode = Timer.ModeSingle
MouseDownTimer.Enabled = True
End Sub
Sub DoubleClick(X As Integer, Y As Integer, Details As REALbasic.MouseEvent)
system.debuglog "doubleclick"
MouseDownTimer.Enabled = False
End Sub
In MouseDown, the timer is launched. If a doubleclick happens, it cancels the timer and its action never fires. If nothing happens within half a second, MouseDownTimer Action fires.
So now you have MouseDown through the Action event of the MouseDownTimer, and DoubleClick in the normal event.
Ok, I’ve implemented your first solution, and it works for the moment
I keep the second