On 21/6/00 7:42 pm, Jacqueline Landman Gay <[EMAIL PROTECTED]> wrote:

> I want to detect a keydown and a keyup when the user is not typing into
> a field. Ideally, the key would be one of the control keys, or maybe the
> space bar -- basically, I want a key that is easily accessible.
> 
> It looks like both keyup and rawkeyup are only sent if the character is
> typed into a field. This stack has no editable fields. I just want to
> know when the key goes down and when it comes back up again.
> 
> A keydown message is sent for various alpha characters at any time, but
> not a keyup. So, for example, I could trap for the space bar going down,
> but there is no way to poll to see if the key has been released, since
> the keypress doesn't go to a field.
> 
> The commandKey, controlKey, optionKey, etc. messages are only sent when
> coupled with another keyboard character. I don't want to use double
> keyboard presses, so I can't use these.
> 
> In a perfect world, I'd like to use the shift key -- but this key by
> itself doesn't trigger any messages at all, no matter what.
> 
> Any ideas?

I think perhaps you're a little confused about the exact meaning of
"keyDown" and "keyUp".  Keydown is sent when a key is pressed, keyUp is sent
after the character has been drawn into the field.  KeyUp doesn't indicate
that the key is *up* - it could still be down, in which case another keyDown
and another keyUp message will be sent.

Because no field is active in your case, no keyUp message will ever be sent.

If you need to query if a key is physically up, you have two choices.  One
is to use shift, option, command, control, or capsloc functions to poll the
state and see if the key is up or down.  The second is to wait a reasonable
period after the last keyDown message - using send...in, cancelling the
message and sending a new one on each keydown so that the message only gets
delivered after the last key is pressed.

Regards,

Kevin

> -- 
> Jacqueline Landman Gay        |             [EMAIL PROTECTED]
> HyperActive Software          |                   [EMAIL PROTECTED]
> Custom hypermedia solutions   |         http://www.hyperactivesw.com
> 612.724.1596                  |                   612.724.1562 - fax

Kevin Miller <[EMAIL PROTECTED]> <http://www.xworlds.com/>
Cross Worlds Computing, MetaCard Distributors, Custom Development.
Tel: +44 (0)131 672 2909.  Fax: +44 (0)1639 830 707.


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to