Equivalent of command click in iOS

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Equivalent of command click in iOS

Post by david_fff »

I want to make a hidden button in an iOS version that only reacts if a key or key combination is pressed while the button is clicked, such as:
if the shift key is down then
do this
end if
but how do I do something like that in an iOS version?
Thanks
David
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey »

Well, I don't think we have a force touch capability, yet, but it is requested, in bug 17185.
look up "mousestilldown". If the user holds their finger for an extended period, would that work?
You could also track multiple touches in short succession, with a bit of scripting.
david_fff
Posts: 29
Joined: Wed Nov 12, 2014 5:29 pm

Re: Equivalent of command click in iOS

Post by david_fff »

Thanks. That should work!
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Equivalent of command click in iOS

Post by dunbarx »

This is fun.

But if find that neither of the following two handlers are stable, that is, they do not fire reliably. In a button script:

Code: Select all

--on mouseStillDown
--   if the mouse is down and the shiftKey is down then answer "both"
--end mouseStillDown

--on mouseWithin
--   if the mouse is down and the shiftKey is down then answer "both"
--end mouseWithin
But this works:

Code: Select all

on mouseDown
   send "testMe" to me
end mouseDown

on testMe
   if the mouse is down and the shiftKey is down then
      answer "both"
      exit to top
   end if
   send "testMe" to me in 1
end testMe
Craig Newman
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey »

The problem was implementing this on ios - no shift key without a keyboard up on screen.
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Equivalent of command click in iOS

Post by dunbarx »

Mikey.

Understood. But I only wanted to demonstrate the reliability of a method.

So even on iOS, if a finger is "down" on screen, then you can test for any other simultaneous condition reliably.

I think this makes sense, no? I do not develop for mobile, so I could be out of my depth.

Craig
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey »

The other event to be watching out for is mouseLeave
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Equivalent of command click in iOS

Post by jmburnod »

Hi
Sometimes I use a timer on iOs where i use command or option key on desktop

What about this in this case ?

Code: Select all

local sStartTime
on mousedown
   put the milliseconds into sStartTime
end mousedown

on mouseUp
   if the milliseconds < (sStartTime + 500) then
      beep
   else
      answer "500 milliseconds passed"
   end if
end mouseUp
Best
Jean-Marc
https://alternatic.ch
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Equivalent of command click in iOS

Post by jacque »

Typically on mobile devices, a long-press substitutes for actions that require a modifier key on desktop. Use Jean-Marc"s timer suggestion to determine whether a long-press has occured.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Post Reply