• 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: What's the best way to limit input on an NSTextField to numbers only? (newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >What's the best way to limit input on an NSTextField to numbers only? (newbie) (From: Rob Frohne <email@hidden>)

  • Prev by Date: What's the best way to limit input on an NSTextField to numbers only? (newbie)
  • Next by Date: Where is the WebServices docs?
  • Previous by thread: What's the best way to limit input on an NSTextField to numbers only? (newbie)
  • Next by thread: Re: What's the best way to limit input on an NSTextField to numbers only? (newbie)
  • Index(es):
    • Date
    • Thread