Equivalent of command click in iOS

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

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

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

Equivalent of command click in iOS

Post by david_fff » Tue Aug 30, 2016 12:42 am

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: 696
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey » Tue Aug 30, 2016 2:46 pm

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 » Tue Aug 30, 2016 6:13 pm

Thanks. That should work!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6163
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Equivalent of command click in iOS

Post by dunbarx » Tue Aug 30, 2016 6:39 pm

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: 696
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey » Tue Aug 30, 2016 6:42 pm

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: 6163
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Equivalent of command click in iOS

Post by dunbarx » Tue Aug 30, 2016 6:52 pm

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: 696
Joined: Fri Jun 27, 2008 9:00 pm

Re: Equivalent of command click in iOS

Post by Mikey » Tue Aug 30, 2016 7:09 pm

The other event to be watching out for is mouseLeave

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2376
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Equivalent of command click in iOS

Post by jmburnod » Tue Aug 30, 2016 9:27 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5108
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Equivalent of command click in iOS

Post by jacque » Wed Aug 31, 2016 7:13 pm

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

Return to “Talking LiveCode”