• 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: Bindings making NSNumberFormatter strange
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Bindings making NSNumberFormatter strange


  • Subject: RE: Bindings making NSNumberFormatter strange
  • From: Ulai Beekam <email@hidden>
  • Date: Thu, 23 Apr 2009 23:58:43 +0000
  • Importance: Normal


> Using control:didFailToFormatString:errorDescription: and always
> returning YES will stop the "Formatting Error" sheet.


Is this the only way to stop that "formatting error" sheet? I tried it and it sure works. A major drawback, however, is that editing ends even if it was invalid.

And that means I have to implement the control:textShouldEndEditing: method and return NO from there if the state is invalid and YES otherwise. If I combine this with the previous method (control:didFailToFormatString:errorDescription:) returning YES, it seems to be working.


But even if it works, it is giving me some headaches because it seems like such a weird solution to get rid of a simple sheet. Why do I think it's weird? Because in the second method (control:didFailToFormatString:errorDescription:) I'm effectively doing all those validation checks all over again. Seems like a strange hack to me.



> A custom NSNumberFormatter subclass can be used to block characters
> that are not in decimalDigitCharacterSet and sound a beep. Read the
> last paragraph of:


Thanks for suggesting this. It seems to be working beautifully.



_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx_______________________________________________

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

References: 
 >Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >RE: Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Keary Suska <email@hidden>)
 >RE: Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Nathan Kinsinger <email@hidden>)

  • Prev by Date: RE: Detecting changes to NSPopUpButtonCell in an NSTableView
  • Next by Date: Re: ObjectAlloc and objects that should have been released
  • Previous by thread: Re: Bindings making NSNumberFormatter strange
  • Next by thread: Re: Bindings making NSNumberFormatter strange
  • Index(es):
    • Date
    • Thread