NSNumberFormatter erases invalid values on Lion with 10.6 SDK
NSNumberFormatter erases invalid values on Lion with 10.6 SDK
- Subject: NSNumberFormatter erases invalid values on Lion with 10.6 SDK
- From: George Nachman <email@hidden>
- Date: Wed, 02 Nov 2011 21:40:45 -0700
I just moved to XCode 4, from the Mac OS 10.5 SDK to the 10.6 SDK, and
from Snow Leopard to Lion. A behavior that changed is that entering
invalid text into an NSTextField with an NSNumberFormatter causes the
entire field's contents to be erased rather than disallowing the bogus
character from being added.
In my example, I have an NSNumberFormatter with a min value of 1, a
max value of 10000000, isLenient, and localization on. Enter a value
like "123" and it's ok. Type a letter "x" and the entire value is
erased.
The erasure occurs when the field's stringValue or intValue is accessed.
The text field and number formatter are defined in a XIB file. I would
like invalid input to be prevented or at worst tolerated and ignored,
but erasing the whole value is really not OK.
Another strange thing that happens is that when entering a value
larger than 10,000 the entire value is erased. The text field's
-stringValue in the delgate's -controlTextDidChange: returns
@"10,0000" and immediately after being evaluated is changed to an
empty string.
Is this behavior intentional? Can I get the old behavior back somehow?
Thanks,
George
_______________________________________________
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