• 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: NSTextField input validation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField input validation


  • Subject: Re: NSTextField input validation
  • From: Keary Suska <email@hidden>
  • Date: Tue, 13 Jan 2009 09:23:11 -0700


On Jan 12, 2009, at 5:22 PM, Adam Venturella wrote:

So there we have it. Again this does do exactly what I want it to do, if
the user tries to enter a letter or anything not a number, I get an
NSBeep(); It works if the operation is a paste operation or initiated by a
keystroke.


My main question, am I doing the right thing by casting the NSText into a
NSTextView, and is the NumberFormatter the best way to go in order to test
for a valid number or should I go the NSScanner route?

Subclassing NSTextFieldCell seems a bit unnecessary--why not just set the NSTextField delegate to one of your controllers? The whole - setUpFieldEditorAttributes seems a bit kludgey to me (and possibly prone to errors).


Also, I would use an NSCharacterSet (-characterIsMember:) instead of NSFormatter or NSSCanner. Much more lightweight.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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


  • Follow-Ups:
    • Re: NSTextField input validation
      • From: "Adam Venturella" <email@hidden>
References: 
 >NSTextField input validation (From: "Adam Venturella" <email@hidden>)

  • Prev by Date: Re: Killall Finder Brings Hidden Apps To Front?
  • Next by Date: ***Junkmail*** How do I programaticly create a va_list
  • Previous by thread: NSTextField input validation
  • Next by thread: Re: NSTextField input validation
  • Index(es):
    • Date
    • Thread