• 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: restricting input to text field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restricting input to text field


  • Subject: Re: restricting input to text field
  • From: Greg Titus <email@hidden>
  • Date: Sat, 8 Oct 2005 08:42:17 -0700


On Oct 8, 2005, at 8:23 AM, Herbert wrote:

In the codewarrior days, it was pretty easy to take the text input class and subclass it so you could restrict text entry on a per character basis (i.e. decimal only or even hex).

Can this be done with the cocoa NSTextField class or perhaps the NSSecureTextField class?

The docs are silent on this, the published api's don't seem promising, anyway.

Hi Herbert,

The way to do this is to set a formatter on the NSTextField, and the NSFormatter subclass can restrict text entry. Check out the NSFormatter -isPartialStringValid:newEditingString:errorDescription: method.

Hope this helps,
    - Greg


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >restricting input to text field (From: Herbert <email@hidden>)

  • Prev by Date: Application suite architecture
  • Next by Date: Re: restricting input to text field
  • Previous by thread: restricting input to text field
  • Next by thread: Re: restricting input to text field
  • Index(es):
    • Date
    • Thread