Page 1 of 1
If some key is down
Posted: Thu Apr 14, 2016 3:49 pm
by croivo
Hello...
How to check if a key is down?
I know for this syntax:
Code: Select all
if the altKey is down then doSomething
But can't manage to change it to work with other keys, like regular letters, tab etc.
Re: If some key is down
Posted: Thu Apr 14, 2016 4:12 pm
by dunbarx
Is "the keysDown" function what you are looking for?
Craig Newman
Re: If some key is down
Posted: Thu Apr 14, 2016 6:00 pm
by atout66
If you want your application to response when the user press a function key, place this script (the beginning to give you an idea) in your main stack.
Code: Select all
on functionKey theKey
lock Screen
switch theKey
case 1 -- HELP
if the controlKey is down then -- load the main help file
launch url ("file:/"&gLePathFolder&"/Aide.pdf")
else -- do regular F1 (inline help)
.......
end if
break
case 2 -- PREFERENCES et STATISTIQUES
if the controlKey is down then -- STATISTIQUES
.....
else -- do regular-> PREFERENCES
Cheers, Jean-Paul.
Re: If some key is down
Posted: Thu Apr 14, 2016 6:20 pm
by richmond62
Check out keyDown, keyUp, rawKeyDown and rawKeyUp;
with these you can "see" whenever ANY key is being used.
Re: If some key is down
Posted: Thu Apr 14, 2016 8:20 pm
by jmburnod
And don't forget "the keysDown" as Craig said.
Best regards
Jean-Marc
Re: If some key is down
Posted: Thu Apr 14, 2016 11:28 pm
by croivo
"the keysDown" is exactly what I was looking for. Thank you all
