Skip navigation.
 
mlRe: How do I change behavior of NSTableView textDidEndEditing
FROM : Brian Webster
DATE : Thu Oct 31 21:34:13 2002

On Thursday, October 31, 2002, at 02:05  PM,
<email_removed> 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_removed>
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlHow do I change behavior of NSTableView textDidEndEditing Bob Peterson Oct 31, 20:06
mlRe: How do I change behavior of NSTableView textDidEndEditing Brian Webster Oct 31, 21:34
mlRe: How do I change behavior of NSTableView textDidEndEditing Andreas Mayer Nov 1, 15:02