|
From: | Andreas Höschler |
Subject: | Re: gui fixes |
Date: | Fri, 31 Aug 2007 12:32:24 +0200 |
Hi all,
*NSControl* The delegate of an NSControl should be able to access validated values with objectValue in -controlTextDidChange:(NSNotification *)obj (at least that's the behavior on MacOSX). - (void)textDidChange: (NSNotification *)aNotification { NSMutableDictionary *dict;// validate NSNumbers immediately so that objectValue returns reasonablevalues in controlTextDidChange: if ([_cell isEntryAcceptable:[[aNotification object] text]]) { [self validateEditing]; } ... }Here I would like to get some evidence that this is what Cocoa does. Youcould for example place a break point in validateEditing and see from where it gets called.
On MacOSX valdiateEditing is called from here: #0 0x9313e878 in -[NSControl validateEditing] () #1 0x931400b8 in -[NSActionCell attributedStringValue] () #2 0x930bb6a8 in _NXDrawTextCell () #3 0x930c8180 in -[NSTextFieldCell drawInteriorWithFrame:inView:] ()Until this is properly figured out, I have changed the above method (temporary hack) as follows, since the above caused problems with date formatters.
- (void)textDidChange: (NSNotification *)aNotification { NSMutableDictionary *dict;// validate NSNumbers immediately so that objectValue returns reasonable values in controlTextDidChange: if ([(NSFormatter *)[_cell formatter] isKindOfClass:[NSNumberFormatter class]])
{ [self validateEditing]; } ... } Regards, Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |