Re: How do I change behavior of NSTableView textDidEndEditing
Re: How do I change behavior of NSTableView textDidEndEditing
- Subject: Re: How do I change behavior of NSTableView textDidEndEditing
- From: Brian Webster <email@hidden>
- Date: Thu, 31 Oct 2002 14:34:13 -0600
On Thursday, October 31, 2002, at 02:05 PM,
email@hidden wrote:
in NSTableView, I want to cause TAB, ENTER and RETURN to terminate
editing, but not open another cell for editing. I don't see any
property or delegate method for managing this. Can anyone offer a
suggestion how to accomplish it?
I wanted to do the very same thing a while back and eventually found a
snippet of code in the OmniAppKit framework that does just that:
- (void)textDidEndEditing:(NSNotification *)notification;
{
//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:0]
forKey:@"NSTextMovement"];
newNotification = [NSNotification notificationWithName:[notification
name] object:[notification object] userInfo:newUserInfo];
[super textDidEndEditing:newNotification];
[[self window] makeFirstResponder:self];
}
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.