Re: NSNumberFormatter behavior [Solved]
Re: NSNumberFormatter behavior [Solved]
- Subject: Re: NSNumberFormatter behavior [Solved]
- From: Chataka <email@hidden>
- Date: Fri, 9 May 2008 08:20:22 +0900
F. Testuz,
Thank you very much for your reply. My both problems were fixed.
I guess the second problem was the same error. I guess the alert panel
is shown only when nil is set through an IB element, and is not shown
when it is set within the code.
-Chataka
On 2008/05/08, at 4:06, Frédéric Testuz wrote:
Le 6 mai 08 à 03:29, Chataka a écrit :
Hello,
My app has a NSTextField on a UI window to accept user input and to
display a NSNumber
in a model object. The NSTextField and the NSNumber are bound using
Cocoa Bindings,
and the NSTextField is set a NSNumberFormatter. It is a very simple
UI but I have two
problems regarding this NSTextField (NSNumberFormatter) which I
don't know how to fix.
One is that the NSTextField can't be blank. When I enter a number
in the NSTextField then
delete the number, an alert panel appears to show "Format error"
and require to fill a number
in the NSTextField. I would like to leave the NSTextField blank
when the number is deleted,
would like to set nil to the NSNumber bound in the model object,
and would like to disable
the alert panel but I don't know how.
The other problem may be the same problem as the first one. I have
a method which
handles the NSNumber in the model object and after all computations
using the NSNumber
finishes, the NSNumber is set nil at the end of the method. But the
NSTextField bound to this
NSNumber isn't cleared and continue to have the same number before
the computation, while
the NSNumber in the model object becomes nil. This breaks a
synchronization between
the UI and the model object and I would like to know how to fix
this too.
In the 10.4 behaviour of NSNumberFormatter use
[myNumberFormatter setNilSymbol:@""];
You can also fix it in IB. Select the formatter, in the attribute
palette go to the nil symbole, type a letter then delete it.
If you have the same problem with NSDateFormatter, the only solution
I found is to subclass NSDateFormatter.
It must fix the problem for the first part, I'm not sure for the
second part.
F. Testuz
_______________________________________________
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