How to detect long touch on mobile

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

How to detect long touch on mobile

Post by terryho » Thu Feb 13, 2014 4:05 pm

Hi all,

I want to detect long touch on mobile device, when long touch pop up a group for user select.

But i try the following code, it does not work :

on mouseDown
// make sure to handle any visual stuff here first, if necessary
wait 300 millisecs with messages
if the mouse is down then
// treat like long mouseClick
else
// treat like short mouseClick
end if
end mouseDown

Please advice, may be I use wrong method

Regards

Terry Ho

FabricioRocha
Posts: 25
Joined: Sun Jan 19, 2014 8:53 pm

Re: How to detect long touch on mobile

Post by FabricioRocha » Thu Feb 20, 2014 5:50 am

I was looking for an example as well, Terry, and I found this thread:

http://forums.runrev.com/viewtopic.php? ... hilit=long

I would also like to try the suggestion made there by jacque: save the time on touchStart in a script variable, get the time at touchEnd, compare these times and, if the difference is bigger than a certain amount, generate a message which could start an "on longtouch" handler.

terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Re: How to detect long touch on mobile

Post by terryho » Tue Feb 25, 2014 4:09 pm

Hi

Thanks your suggestion on checking on timer, I will try it.

Regards

Terry Ho

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How to detect long touch on mobile

Post by jmburnod » Tue Feb 25, 2014 5:33 pm

Hi Terry,

Here is a stack with two methods using duration of mousedown

Best regards
Jean-Marc
Attachments
CheckingMousedownDuration001.livecode.zip
(2.63 KiB) Downloaded 231 times
https://alternatic.ch

Post Reply