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: Andreas Mayer <email@hidden>
- Date: Fri, 1 Nov 2002 15:02:18 +0100
Am Donnerstag, 31.10.02 um 20:06 Uhr schrieb Bob Peterson:
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?
Subclass NSTableView and overwrite textDidEndEditing:
I think I posted some sample code in the macosx-dev list a few days ago
... here it is:
- (void)textDidEndEditing:(NSNotification *)aNotification
{
BOOL doEdit = YES;
[super textDidEndEditing:aNotification];
switch ([[[aNotification userInfo] objectForKey:@"NSTextMovement"]
intValue]) {
case NSReturnTextMovement: // return
{
doEdit = NO;
break;
}
case NSBacktabTextMovement: // shift tab
{
doEdit = YES;
break;
}
//case NSTabTextMovement: // tab
default:
{
doEdit = YES;
}
} // switch
if (!doEdit) {
[self validateEditing];
[self abortEditing];
// do something else ...
}
}
bye. Andreas.
_______________________________________________
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.