Re: keyEvent characters
Re: keyEvent characters
- Subject: Re: keyEvent characters
- From: rsharp <email@hidden>
- Date: Mon, 8 Oct 2001 07:14:56 -0500 (CDT)
On Mon, 8 Oct 2001, Angela Brett wrote:
>
I have a question about key events. It says in the documentation:
>
>
- (NSString *)characters
>
Returns the characters associated with the receiving key-up or
>
key-down event. These characters
>
are derived from a keyboard mapping that associates various key
>
combinations with Unicode
>
characters. Raises an NSInternalInconsistencyException if sent to any
>
other kind of event.
>
>
My question is, when would there be more than one character? I guess
>
somehow several keys could be pressed or released at exactly the same
>
time, but even then I would think they would generate separate
>
events. Is it safe to always assume that there's only one character?
Some have already responded, but I think there are two separate issues
here. When you speak of multiple keys being pressed (chording), I don't
think Mac OS X yet has support for that in terms of an easy to use API. I
know on the Carbon side, you'd probably just want to read the keymaps
directly to see if simultaneous keys are down.
The other issue deals with some keypress generating multi-byte characters
(e.g. surogate pairs). I believe that in this case, you will get all the
appropriate characters.
HTH,
Rick Sharp
Instant Interactive(tm)