Re: WM_KEYDOWN
Re: WM_KEYDOWN
- Subject: Re: WM_KEYDOWN
- From: John Stiles <email@hidden>
- Date: Wed, 11 Apr 2007 10:01:54 -0700
You might look into
- (void)controlTextDidChange:(NSNotification *)aNotification
I bet this will handle whatever you need. I use this for a text field
that contains a product registration number—we want to make the
formatting match the label on the CD case. So after every keystroke I
filter out bogus characters and add in hyphens where needed.
On Apr 11, 2007, at 2:51 AM, Uli Kusterer wrote:
Am 11.04.2007 um 11:06 schrieb xcocoa:
I am looking for a way to get a simply MS Windows WM_KEYDOWN alike
message (notification) when using a NSTextField.
Not sure you really want that. If you want to handle keyboard
shortcuts, keyDown: would probably fit the bill. But keep in mind
that NSTextField doesn't just do ASCII. It does all sorts of
international character sets, some of which use several Unicode
"characters" to express an actual character (e.g. Japanese and
Chinese).
So, you may want to have a look at the NSTextView and NSText
delegate methods, some of which give you an NSString with the
Unicode "character" sequence for the character last entered when
they notify you one was entered. Each NSTextField uses an
NSTextView called the "field editor" to do its actual work.
On my web site, my UKSyntaxColoredTextDocument, for example,
creates an NSTextView and registers for its delegate methods to
actually change the text as you're typing it. It's probably not
100% international-safe yet, but at least safer than using keyDown:
directly.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden