Re: What's the best way to limit input on an NSTextField to numbers only? (newbie)
Re: What's the best way to limit input on an NSTextField to numbers only? (newbie)
- Subject: Re: What's the best way to limit input on an NSTextField to numbers only? (newbie)
- From: Scott Anguish <email@hidden>
- Date: Mon, 2 Sep 2002 02:33:05 -0400
On Monday, September 2, 2002, at 01:58 AM, Rob Frohne wrote:
Hi All,
I'd like to limit input into my NSMatrix of NSTextFields to be numbers
only, things like 3.2e5, or 5.5 or 9.99. I got a delegate that gets
run when the NSTextFields change, but the NSString I get isn't quite
as simple to process as just the individual keys that are being typed.
I've looked at NSScanner, and it looks like that might have some
merit. Is that the best way to handle this kind of thing?
Have a look at NSFormatter... Specifically, NSNumberFormatter
this does exactly what you want, and once written is easily reused
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.