Re: sorry for repeating it, NSTableView and *not* selecting the next line?
Re: sorry for repeating it, NSTableView and *not* selecting the next line?
- Subject: Re: sorry for repeating it, NSTableView and *not* selecting the next line?
- From: email@hidden
- Date: Fri, 1 Feb 2002 18:18:35 -0800
The only way that I have found to do this is by subclassing NSTableView.
(btw, you can search these messages and omnigroup's at
cocoa.mamasam.com). Anyways, this is the code that someone suggested to
use in your subclass (you just override this one method). It works for
me, but I haven't looked at it hard to find anything wrong with it...
- (void)textDidEndEditing:(NSNotification *)notification;
{
if ([[[notification userInfo] objectForKey:@"NSTextMovement"]
intValue] == NSReturnTextMovement) {
// This is ugly, but just about the only way to do it.
NSTableView is determined to select and edit something else, even the
text field that it just finished editing, unless we mislead it about
what key was pressed to end editing.
NSMutableDictionary *newUserInfo;
NSNotification *newNotification;
newUserInfo = [NSMutableDictionary
dictionaryWithDictionary:[notification userInfo]];
[newUserInfo setObject:[NSNumber
numberWithInt:NSIllegalTextMovement] forKey:@"NSTextMovement"];
newNotification = [NSNotification
notificationWithName:[notification name] object:[notification object]
userInfo:newUserInfo];
[super textDidEndEditing:newNotification];
// For some reason we lose firstResponder status when when we do
the above.
[[self window] makeFirstResponder:self];
} else {
[super textDidEndEditing:notification];
}
}
On Friday, February 1, 2002, at 04:50 PM, Ondra Cada wrote:
Hi,
unless I overlooked something important, the search engine of Apple is
next
to useless due to the fact that it does not search in messages, but in
a big
chunks of many of them :(
Therefore, please, if someone happens to have a solution of the famous
problem discussed here some time ago, eg.
- how to make NSTableView just finish editing when Enter is pressed
(instead
of selecting next line as if it were a spreadsheet)
send it please to me. TIA,
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.