F keys cross-platform?

Scott Rossi scott at tactilemedia.com
Tue Sep 22 05:19:58 EDT 2009


Recently, Richmond Mathewson wrote:

> I have set the HELP palette to open with F1 (regardless of platform)
> and am leveraging F2, F3, F4 for my own nefarious purposes.
> 
> The real reason I am having to use the F keys is because modifier
> keys (Ctrl, Alt/Opt, Command, Shift) don't produce rawKeyDown
> signals on Mac. This is actually a bl**dy nuisance as it seems
> more naturalistic for my end-users to be able to switch from
> Sanskrit consonants to vowels with the Shift key than an F key:
> but, short of having a punch-up with Steve Jobs, that is the way
> things will have to be.

You can't use the built-in messages/functions?
 optionKeyDown
 controlKeyDown
 shiftKey()

Not sure what you need exactly, but you also might want to look into the
keysDown() function -- it requires some polling, but allows you to capture
key codes/states for the shift and control keys (at least it does here).
A simple button script example that displays all key presses (with the
button's autoHilite set to false so you can toggle the polling loop):

on mouseDown
   set hilite of me to not the hilite of me
   if "runKeyTrap" is not in pendingMessages() then runKeyTrap
end mouseDown

on runKeyTrap
   if not the hilite of me then exit runKeyTrap
   put keysDown()
   send "runKeyTrap" to me in 50 millisecs
end runKeyTrap


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list