Re: Editing in NSOutlineView
Re: Editing in NSOutlineView
- Subject: Re: Editing in NSOutlineView
- From: Ondra Cada <email@hidden>
- Date: Mon, 22 Apr 2002 17:21:11 +0200
On Monday, April 22, 2002, at 04:43 , Gokul Hegde wrote:
In my application, I am trying to edit the items which I display in
NSOutlineView. When I double click on the items, I am able to edit it.
But,
I find that on pressing 'Return', to finish my editing, the next item gets
selected and editing for it begins.
That's standard behaviour, though kinda unlucky one.
Has any body found a soulution for this? How do I make the NSOutlineView
stop this editing of next item?
Do search archives.
I know of this
- (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];
}
}
but I kind of quite uncertainly recall someone posted something (which was
said to be) less hackish.
---
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.