• 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: How do I change behavior of NSTableView textDidEndEditing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: NSComboBox bug?
  • Next by Date: PCH?
  • Previous by thread: How do I change behavior of NSTableView textDidEndEditing
  • Next by thread: changing colors in NSTableView
  • Index(es):
    • Date
    • Thread