• 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
How to disable non-roman input in NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to disable non-roman input in NSTextField


  • Subject: How to disable non-roman input in NSTextField
  • From: Jay Bruins <email@hidden>
  • Date: Mon, 24 Sep 2007 15:18:28 -0700
  • Acceptlanguage: en-US
  • Thread-topic: How to disable non-roman input in NSTextField

I have an NSTextField in an installer pane that is supposed to accept a product key. A product key is typical roman alphanumeric string (a-zA-Z0-9). Because the application is used internationally, I would like to force the input method to roman to prevent the user from attempting to enter non-roman (e.g. Katakana) characters.

NSFormatter is insufficient because the text field/formatter do not receive the user's input until after input is fully determined (Katakana and other input methods do not have a 1-to-1 mapping of keystrokes to characters). Users expect to enter roman characters into this field but should not have to change their input source to do so.

It is possible to hack something together to determine when the field has focus, call carbon methods (GetScriptManagerVariable, KeyScript, etc) to save/change the system script, and then restore the script when the field loses focus, but this is messy.

The code is expected to run on 10.4 and later.

Any leads on how best to resolve this would be much appreciated.

J
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Prev by Date: Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry
  • Next by Date: Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry
  • Previous by thread: Re: best way to deal with resizable controls that can go to zero?
  • Next by thread: NSPersistentDocument Merged Model Problem
  • Index(es):
    • Date
    • Thread