This is a newbie question, my apologies if it has been discussed in the past. I haven't been programming on a Mac since the System 7 days and trying to catch up with OS X and Cocoa...

I have text field bound to an NSObjectController with an NSNumberFormatter to ensure that there are only integer numbers entered. Whenever I leave the field blank or enter invalid characters, I get a very generic error message "Formatting Error". I'd like to customize that error message with a hint for the user which values are valid (similar to the message I get in the standard print dialog when entering zero copies), but I haven't found a way to do so, except for, perhaps, subclassing NSNumberFormatter. I had a look at - control:didFailToFormatString:errorDescription:, but noticed that the error description is not a mutable string, therefore I cannot pass back a modified error message. Is there a way to customize the error message without having to create a new subclass of NSNumberFormatter for each field with a different format?

On a related topic, if I set "Validates Immediately" on the binding of that particular field, I was expecting to be stopped in my tracks as soon as I enter, say, a letter instead of a number, but nothing happens. It seems like the setting of the Validates Immediately flag doesn't have any impact on the behavior. Am I missing something here?
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to