Re: restricting input to text field
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