• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOutlineView editing...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView editing...


  • Subject: Re: NSOutlineView editing...
  • From: Stéphane Sudre <email@hidden>
  • Date: Mon, 31 Mar 2003 19:42:45 +0200

On Monday, March 31, 2003, at 06:37 PM, Greg Casey wrote:

I know this must have already been asked and answered by now, because it seems like it would be a common request. But, I haven't been able to find the information I need (after spending a lot of time looking), so please bear with me.

I have an NSOutlineView and I want it to act very similar to how ProjectBuilder's "Files" view acts. You can control-click an item in the view and enter "Rename" mode. This causes the outline view to enter edit mode for that table column. You type the new name in and hit the return key. The item's new name is set and the item remains selected but no longer in edit mode.

The default behavior of NSOutlineView when a user hits the return key while in edit mode is to advance to the next item in the list and initiate editing of that item. How can I make NSOutlineView behave like ProjectBuilder's outline view instead?

Thanks in advance for your advice!

from the OmniAppKit source code:


- (void)textDidEndEditing:(NSNotification *)notification;
{
if (flags.shouldEditNextItemWhenEditingEnds == NO && [[[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];
}
}
_______________________________________________
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.
  • Follow-Ups:
    • Re: NSOutlineView editing...
      • From: Greg Casey <email@hidden>
References: 
 >NSOutlineView editing... (From: Greg Casey <email@hidden>)

  • Prev by Date: NSOutlineView editing...
  • Next by Date: Re: NSView setVisible: method -- NOT
  • Previous by thread: NSOutlineView editing...
  • Next by thread: Re: NSOutlineView editing...
  • Index(es):
    • Date
    • Thread