Android Long Click
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Android Long Click
Can anyone tell me how to check for a "longclick" in Android? Thanks in advance.
Re: Android Long Click
Hi,
Have you tried the mouseStillDown message?
Kind regards,
Mark
Have you tried the mouseStillDown message?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Android Long Click
Hi Mark,
"The mouseStillDown message is sent only when the Browse tool is being used. If an unlocked field is clicked with mouse button 1 or 2, no mouseStillDown message is sent."
From the Dictionary:Have you tried the mouseStillDown message?
"The mouseStillDown message is sent only when the Browse tool is being used. If an unlocked field is clicked with mouse button 1 or 2, no mouseStillDown message is sent."
Re: Android Long Click
Hi,
I don't understand your reply.
Mark
I don't understand your reply.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Livecode Opensource Backer
- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
- Location: Seattle, USA
Re: Android Long Click
Good to know about--
Though, this only works for Button objects.
Nothing with Field and DataGrid objects. I was hoping I could change a mouseStillDown on a DataGrid into a double click message, which would be good for Mobil appliations, where double clicks are rare.
Code: Select all
on mouseStillDown
beep
end mouseStillDown
Nothing with Field and DataGrid objects. I was hoping I could change a mouseStillDown on a DataGrid into a double click message, which would be good for Mobil appliations, where double clicks are rare.
Re: Android Long Click
OK, I get it...
Maybe you can do something like this:
Kind regards,
Mark
Maybe you can do something like this:
Code: Select all
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
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Livecode Opensource Backer
- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
- Location: Seattle, USA
Re: Android Long Click
How about that? Nice. I had all but given up on this one.
Code: Select all
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
beep
send "mouseDoubleDown" to me
else
--treat like short mouseClick
end if
end mouseDown
on MouseDoubleDown
answer "Works Good"
end MouseDoubleDown
Re: Android Long Click
Makes sense. Thanks so much!
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Android Long Click
Man!
Where do you guys get this stuff?
Where do you guys get this stuff?
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Android Long Click
25 year experience, Barry
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Android Long Click
Does the check for the mouse state work? I tried to do that in iOS and it failed every time, I assume because there is no mouse. Does it work in Android?
I'd like to know if it works on a real device, because I have a project that needs it. It would be nice not to have to do a lot of workarounds.
[edit]: By the way, the typical way to detect a long press is to store the milliseconds on touchStart and then compare that with the current milliseconds on touchEnd. If the difference is more than a certain amount, assume a long press.
I'd like to know if it works on a real device, because I have a project that needs it. It would be nice not to have to do a lot of workarounds.
[edit]: By the way, the typical way to detect a long press is to store the milliseconds on touchStart and then compare that with the current milliseconds on touchEnd. If the difference is more than a certain amount, assume a long press.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Android Long Click
Jaque,
Can you please post a working sample?
Can you please post a working sample?
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Re: Android Long Click
Hi,
Interesting. The mouse() function always returns "up" in Android. I wonder if that's a bug or intended behaviour. I'd say it is a bug, particularly because the mouseStillDown message does seem to work.
MouseStillDown doesn't work in unlocked fields because these fields can't receive mouse event messages! Fields only receive openField, closeField and exitField messages when you click in or outside them (and a few other messages such as selectionChanged, which seem less relevant at this point). This is normal.
In closed fields, buttons and cards, the mouseStillDown message works as expected in Android.
Kind regards,
Mark
Interesting. The mouse() function always returns "up" in Android. I wonder if that's a bug or intended behaviour. I'd say it is a bug, particularly because the mouseStillDown message does seem to work.
MouseStillDown doesn't work in unlocked fields because these fields can't receive mouse event messages! Fields only receive openField, closeField and exitField messages when you click in or outside them (and a few other messages such as selectionChanged, which seem less relevant at this point). This is normal.
In closed fields, buttons and cards, the mouseStillDown message works as expected in Android.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Android Long Click
Yeah, that's what happened in iOS too. It wrecked a lot of code in an old stack I was trying to convert. I don't know if it's a bug or a limitation in the OS, but I can report it.Mark wrote:Hi,
Interesting. The mouse() function always returns "up" in Android. I wonder if that's a bug or intended behaviour. I'd say it is a bug, particularly because the mouseStillDown message does seem to work.
Barry, the example would be the code segment that Mark suggested.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 1201
- Joined: Sun Apr 24, 2011 2:17 am
Re: Android Long Click
Righto.jacque wrote:Barry, the example would be the code segment that Mark suggested.
Thought you were writing about a different procedure.
Thanks for the clarification.
All my best,
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.
Barry G. Sumpter
Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.