Trapping the Option or Command keys

J. Landman Gay jacque at hyperactivesw.com
Mon Jul 27 15:00:45 EDT 2009


Richmond Mathewson wrote:

> 2.  The only 'problem' as far as I recall is that on a Mac the COMMAND key
>     (with a stylised apple on it) does the work of the CONTROL key in 
> Windows.

Actually there's a bigger problem. Neither Mac OS nor Mac OS X send any 
keydown information about the Command or Control keys until a second 
letter is typed (same for Shift and Option too.) Rev can't generate 
keydown or rawkeydown messages on those because the OS doesn't notify 
the engine anything has happened.

The only way to see if those keys are being depressed on a Mac is to 
pair it with another system message, such as mouseEnter. Once you get a 
system message triggered, you can check the state of the key inside that 
handler ("if the commandkey is down...", etc.) I suppose one could use a 
mousemove handler to check the state. That would fire repeatedly, which 
may slow things down a bit, but probably not too much.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list