Re: Distinguishing displayable vs. functional keys in an event?
Re: Distinguishing displayable vs. functional keys in an event?
- Subject: Re: Distinguishing displayable vs. functional keys in an event?
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 18 Jun 2002 20:05:00 -0700
On Tuesday, June 18, 2002, at 07:40 PM, Dan Wood wrote:
I'm trying to intercept keydowns events and distinguish the
"displayable" keystroke characterss (the ones that actually add
to a string as they are typed) from the "functional" keystroke
characters (the other ones like up/down arrows, function keys,
etc.) so that I'll know how to process the event -- whether to
use the keystrokes or let the view's superclass process the
event.
I really don't want to hard-wire any string constants into my
code, unless there is some accepted way to do this. Are there
any methods or techniques for determining whether a
string/character is displayable or not?
See NSCharacterSet. Testing the characters in the event's
string for membership in [NSCharacterSet controlCharacterSet] or
[NSCharacterSet whiteSpaceAndNewLineCharacterSet] should get
you what you want.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.