Page 1 of 1

Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 12:42 am
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

Re: Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 2:46 pm
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.

Re: Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 6:13 pm
by david_fff
Thanks. That should work!

Re: Equivalent of command click in iOS

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

Re: Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 6:42 pm
by Mikey
The problem was implementing this on ios - no shift key without a keyboard up on screen.

Re: Equivalent of command click in iOS

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

Re: Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 7:09 pm
by Mikey
The other event to be watching out for is mouseLeave

Re: Equivalent of command click in iOS

Posted: Tue Aug 30, 2016 9:27 pm
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

Re: Equivalent of command click in iOS

Posted: Wed Aug 31, 2016 7:13 pm
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.