UserInput Mouseup and Doublemouseup
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: UserInput Mouseup and Doublemouseup
Ok, here is a try, I tried to develop your suggestion to store the first keystroke, is much less than perfect, it would be great if someone could improve it a bit...
- Attachments
-
- Keys.livecode.zip
- (1.11 KiB) Downloaded 151 times
Re: UserInput Mouseup and Doublemouseup
Hello.
I have to add a "hold" to the all thing and I came up with the following.
Beside the evident dealy on single click, it works on desktop. Now I will try it on mobile...
Any improvement suggestion will be welcomed.
I have to add a "hold" to the all thing and I came up with the following.
Beside the evident dealy on single click, it works on desktop. Now I will try it on mobile...
Any improvement suggestion will be welcomed.
Code: Select all
local sMouseDownTime, sFlag
on mouseUp pMouseButton
put true into sFlag
send "mouseUpStuff" to me in the doubleClickInterval milliseconds
end mouseUp
on mouseDoubleUp pButtonNumber
put false into sFlag
put "double click" & cr after msg
beep
--do stuff here
end mouseDoubleUp
on mouseDown pButtonNumber
put the seconds into sMouseDownTime
end mouseDown
on mouseStillDown pButtonNumber
if sMouseDownTime is not empty AND the seconds - sMouseDownTime >= 2 then
put "hold" & cr after msg
put empty into sMouseDownTime
beep
--do stuff here
end if
end mouseStillDown
on mouseUpStuff
if sMouseDownTime is not empty then
if the seconds - sMouseDownTime >= 2 then
put "hold" & cr after msg
else
if sFlag then
put "1 click" & cr after msg
beep
--do stuff here
end if
end if
end if
end mouseUpStuff
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: UserInput Mouseup and Doublemouseup
Trevix.
Did you mean to jump into a 12 year old thread?
Anyway, what are you trying to do? The handlers you posted detect a double click within the doubleClickInterval.
The original thread dealt with distinguishing between single and double clicks. I never felt comfortable including both a mouseUp and a mouseDoubleUp handler in the same script, which is why I mentioned this dodge. And this was developed over 30 years ago, in HC, where there was no "mouseDoubleUp" message at all.
Craig
Did you mean to jump into a 12 year old thread?
Anyway, what are you trying to do? The handlers you posted detect a double click within the doubleClickInterval.
The original thread dealt with distinguishing between single and double clicks. I never felt comfortable including both a mouseUp and a mouseDoubleUp handler in the same script, which is why I mentioned this dodge. And this was developed over 30 years ago, in HC, where there was no "mouseDoubleUp" message at all.
Craig
Re: UserInput Mouseup and Doublemouseup
Yes sir. I meant since the thread dealt with click and double click but did not consider hold, that, in my umble opinion, is part of the all .
My standalone on mobile, connects with sockets to a remote standalone (on mobile too).
The mobile A shows a screenShot (received from B) and should allow the user to do a 1Click, a double click and a hold, that get transmitted to mobile B.
This has to be done with a single button on mobile A, for several reasons that regards the UX.
My finding is that my script works well on OSX, not so on mobile.
On iOS hardware, "single click" and "hold" work fine, but "double click" sometime reports two times "single click", no matter how is the interval in between the two touches.
Not sure what is the pattern that explain while sometimes it works and sometimes it doesn't. It seems tough that if the two touches interval is too short or too long, I get twice single click. So, it could be my code...
on Android hardware, is, more or less as in iOS: double click are randomly obtained. In this was the speed of the two touches has a less relevant effect
Any help is appreciated.
Trevix
My standalone on mobile, connects with sockets to a remote standalone (on mobile too).
The mobile A shows a screenShot (received from B) and should allow the user to do a 1Click, a double click and a hold, that get transmitted to mobile B.
This has to be done with a single button on mobile A, for several reasons that regards the UX.
My finding is that my script works well on OSX, not so on mobile.
On iOS hardware, "single click" and "hold" work fine, but "double click" sometime reports two times "single click", no matter how is the interval in between the two touches.
Not sure what is the pattern that explain while sometimes it works and sometimes it doesn't. It seems tough that if the two touches interval is too short or too long, I get twice single click. So, it could be my code...
on Android hardware, is, more or less as in iOS: double click are randomly obtained. In this was the speed of the two touches has a less relevant effect
Any help is appreciated.
Trevix
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: UserInput Mouseup and Doublemouseup
OK.
But have you tried the solution I posted early on:
Craig
But have you tried the solution I posted early on:
Code: Select all
on mouseup
wait 20
if the mouseClick then
beep 2
--doDoubleStuff
else
beep 1
--doSingleStuff
end if
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: UserInput Mouseup and Doublemouseup
As noted, the "20" is just a value I made up. The "doubleClickInterval" likely is more grown-up.
Craig
Craig
Re: UserInput Mouseup and Doublemouseup
Apparently the MouseClick trows an error on Android.
On iOS the double click doesn't work at all.
On OSX works fine.
Any idea?
See attached example.
Thanks
On iOS the double click doesn't work at all.
On OSX works fine.
Any idea?
See attached example.
Thanks
- Attachments
-
- TestVariousClicks.livecode.zip
- (2 KiB) Downloaded 56 times
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: UserInput Mouseup and Doublemouseup
Trevix.
I don't work in mobile. I can barely talk on one.
Someone here might know if the "mouseClick" is not a supported mobile function.
Craig
I don't work in mobile. I can barely talk on one.
Someone here might know if the "mouseClick" is not a supported mobile function.
Craig
Re: UserInput Mouseup and Doublemouseup
The dictionary says it is...
I will submit a bug report
I will submit a bug report
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: UserInput Mouseup and Doublemouseup
I'd just have a FIELD (perhaps call it 'Klaus') to hold a sign if the mouse has been clicked once, so a second click has either NO effect or runs another script.
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: UserInput Mouseup and Doublemouseup
Trevix,
for the doubleClick to work on iOS you have to set the "doubleClickDelta" to a value around 10 to 12 from the default 4.
Because on mobile the finger is not as precise as a mouse or a trackpad. I.e. the second click for "double" might easily be more than 4 pixel away
From the dictionary
doubleClickDelta
Also have a look at the doubleClickIntervalType property
Syntax
set the doubleClickDelta to numberOfPixels
Kind regards
Bernd
Re: UserInput Mouseup and Doublemouseup
Thanks for the very useful suggestion.
I tested my script on various Android versions and apparently they react differently to the DoubleClickInterval.
I guess it dipends on the processor, the OS version, the screen, else.
Since my standalone should work on Android 9> and iOS 12>, it is going probably to be very difficult to set this value for each device...
I give up. I will have to find a different solution...
Regards
I tested my script on various Android versions and apparently they react differently to the DoubleClickInterval.
I guess it dipends on the processor, the OS version, the screen, else.
Since my standalone should work on Android 9> and iOS 12>, it is going probably to be very difficult to set this value for each device...
I give up. I will have to find a different solution...
Regards
Code: Select all
local sMouseDownTime
on mouseUp pMouseButton
put "up" & cr after fld "LabelEdit" of the owner of me
if sMouseDownTime is not empty then
send "mouseUpStuff" to me in the doubleClickInterval milliseconds
end if
end mouseUp
on mouseDoubleUp pButtonNumber
put empty into sMouseDownTime
put "double click" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
end mouseDoubleUp
on mouseDown pButtonNumber
put "down" & cr after fld "LabelEdit" of the owner of me
if sMouseDownTime is empty then
put the seconds into sMouseDownTime
end if
end mouseDown
on mouseStillDown pButtonNumber
if sMouseDownTime is not empty AND (the seconds - sMouseDownTime) >= 2 then
put empty into sMouseDownTime
put "hold" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
end if
end mouseStillDown
on mouseUpStuff --single click
if sMouseDownTime is not empty then
put "1 click" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
end if
end mouseUpStuff
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: UserInput Mouseup and Doublemouseup
Trevi,
I think the doubleClickDelta is more important than the doubleClickInterval. Try to set that to 10 or 12 in an openStack handler and see what happens.
Kind regards
Bernd
I think the doubleClickDelta is more important than the doubleClickInterval. Try to set that to 10 or 12 in an openStack handler and see what happens.
Kind regards
Bernd
Re: UserInput Mouseup and Doublemouseup
Yes, I did in the openstack and it really changed everything.
But the behaviour of the DoubleClick Interval is still too different on different devices...
But the behaviour of the DoubleClick Interval is still too different on different devices...
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: UserInput Mouseup and Doublemouseup
May be...
Setting the parameters in the PreOpenstack like this:
This code seems to work on all mobile platform and OSX, even tough not so much reactive.I am also not sure the flushEvent("mouseDown") is sorting any effect.
Setting the parameters in the PreOpenstack like this:
Code: Select all
set the doubleClickDelta to 20
if the environment = "Mobile" then
set the doubleClickInterval to 400
end if
Code: Select all
local sFlagStop,sMouseDownTime
on mouseDown pButtonNumber
--put "down" & cr after fld "LabelEdit" of the owner of me
if not sFlagStop then
send "mouseUpStuff" to me in the doubleClickInterval milliseconds
put the seconds into sMouseDownTime
end if
end mouseDown
on mouseDoubleUp pButtonNumber
put true into sFlagStop
put "double click" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
wait 3 seconds --fake other script running
put flushEvents("mouseDown") into temp
send "SetTheFlag false" to me in 1 seconds
end mouseDoubleUp
on mouseStillDown pButtonNumber
--put "mouseStillDown" & cr after fld "LabelEdit" of the owner of me
if sMouseDownTime is not empty AND (the seconds - sMouseDownTime) >= 2 then
put true into sFlagStop
put empty into sMouseDownTime
put "hold" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
send "SetTheFlag false" to me in 1 seconds
end if
end mouseStillDown
on mouseUpStuff --single click
if not sFlagStop AND the mouse is not down then
put "1 click" & cr after fld "LabelEdit" of the owner of me
beep
--do stuff here
put last char of the short name of me into tNum
wait 3 seconds --fake other script running
end if
end mouseUpStuff
On SetTheFlag pValue
put pValue into sFlagStop --avoid another mousedown
end SetTheFlag
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>