Re: keyEvent characters
Re: keyEvent characters
- Subject: Re: keyEvent characters
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 8 Oct 2001 02:14:47 -0700
On Monday, October 8, 2001, at 02:02 AM, Angela Brett wrote:
Hi,
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?
If the API allows for multiple characters, then it's not safe to assume
that you'll only get one. While you might not ever see multiple
characters per keystroke in English, I would be careful to avoid relying
on that.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.