|
From: | Andreas Höschler |
Subject: | Re: NSControl fix |
Date: | Thu, 30 Aug 2007 16:19:42 +0200 |
Hi Fred,
I still think this patch, which you did propose before is wrong. Weshould do the validation when accessing the value of the cell. Accordingto the specification this gets done in NSActionCell for int, float and string values, but not for the object value itself. Which specific subclass of NSCell are you using? Perhaps the implementation of this class is wrong.
I encounter the problem with a NSTextField and an NSNumberFormatter. The objectValue returned by the NSTextField is nil until the text field is left. MacOSX presents a valid objectValue while the string is edited, as long as it can be converted to a number, otherwise nil (of course).
I currently use the following NSControl implementation: - (void)textDidChange: (NSNotification *)aNotification { NSMutableDictionary *dict;// validate NSNumbers immediately so that objectValue returns reasonable values in controlTextDidChange:
if ([_cell isEntryAcceptable:[[aNotification object] text]]) { [self validateEditing]; } ... } Regards, Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |