scope puzzle with menus

J. Landman Gay jacque at hyperactivesw.com
Wed Nov 16 01:39:04 EST 2005


Charles Hartman wrote:
> Jacque,
> 
> I would not have thought of that in 127 days. Thank you!
> 
> (I'm still a little puzzled. I still don't see why my "script local"  
> variable is getting tampered with by something outside the script at  
> all. I fear I'm missing a General Concept here.)

Well, if you open the message watcher and then press and release a key 
you'll see something like this:

rawKeyDown
keyDown
rawKeyUp
keyUp

Each of those is a different system message and each carries as a 
parameter the key you have pressed and/or released. If you hold down the 
Command key while doing the same thing, you only get these messages:

rawKeyDown
rawKeyUp
keyUp

There is no "keydown" message sent when the Command key is down. You can 
take advantage of that to trap only plain keypresses.

Let's say you've pressed Cmd-U. The reason the key is included in your 
script local when using a "keyUp" handler is because Rev is sending both 
rawKeyUp-U and keyUp-U. The menus act on the rawKeyDown/Up messages, but 
that's only half the set; your script is trapping the keyUp and storing 
the "U".

It is natural to think of a keypress as a single "up" or "down" event, 
but it's really two sets.

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



More information about the use-livecode mailing list