• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WM_KEYDOWN
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WM_KEYDOWN


  • Subject: Re: WM_KEYDOWN
  • From: John Stiles <email@hidden>
  • Date: Wed, 11 Apr 2007 10:33:46 -0700

On Apr 11, 2007, at 10:18 AM, xcocoa wrote:

John,

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.

Where do you get the keystroke from ?

I really appreciate if you could post a small code sample

thanks,

You can't directly get the "keystroke" with this technique, since it is called on any control text changes—e.g. if you paste text or drag text in, that also causes the control text to change. (Also, if you are using a Japanese/Chinese input method, you will see big changes all at once because of the way those input methods work.) But of course, you need to handle all of these cases as well, so just raw keystrokes are not enough—there are lots of ways to get text into a control, not just typing one ASCII character at a time.


What you can do is keep tabs on what the control text used to be, and then look at what it is now, and compare the two to see what changed.

_______________________________________________

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


References: 
 >WM_KEYDOWN (From: xcocoa <email@hidden>)
 >Re: WM_KEYDOWN (From: Uli Kusterer <email@hidden>)
 >Re: WM_KEYDOWN (From: John Stiles <email@hidden>)
 >Re: WM_KEYDOWN (From: xcocoa <email@hidden>)

  • Prev by Date: Re: elegant sheet cascade handling?
  • Next by Date: CoreData Updating Max pk error?
  • Previous by thread: Re: WM_KEYDOWN
  • Next by thread: Re: WM_KEYDOWN
  • Index(es):
    • Date
    • Thread