Skip navigation.
 
mlNSNumberFormatter behavior
FROM : Chataka
DATE : Tue May 06 03:29:04 2008

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.

Thank you,
Chataka

Related mailsAuthorDate
mlNSNumberFormatter behavior Chataka May 6, 03:29
mlRe: NSNumberFormatter behavior Frédéric Testuz May 7, 21:06
mlRe: NSNumberFormatter behavior [Solved] Chataka May 9, 01:20