• 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: Overriding the new inter-cell navigation of NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding the new inter-cell navigation of NSTableView


  • Subject: Re: Overriding the new inter-cell navigation of NSTableView
  • From: Corbin Dunn <email@hidden>
  • Date: Mon, 03 Dec 2007 12:41:09 -0800



I found that the keyDown: + interpretKeyEvents method wouldn't work with the NSTextFieldCell so I ended up overriding endEditing: (tv is an outlet to the parent tableView of the cell):


- (void)endEditing:(NSText *)textObj {

  int editedRow = [tv editedRow];
  int editedColumn = [tv editedColumn];
  int numberOfRows = [tv numberOfRows];

editedRow ++;
editedRow = (editedRow == numberOfRows ? 0 : editedRow); // Selects the first row when the las one is reached.


  [super endEditing:textObj];

  // Select the row (needed to avoid an exception to be raised).
  [tv selectRow:editedRow byExtendingSelection:NO];

  [tv editColumn:editedColumn
	       row:editedRow
	 withEvent:nil
	    select:YES];
}

It works, but is it the best way? It looks more like a workaround than like the regular way of customizing "the tab-loop behavior"... And what if I want to take different actions according to the key that ended the editing?

You could override:

- (void)textDidEndEditing:(NSNotification *)notification {
NSText *textObject = [notification object];
NSInteger whyEnd = [[[notification userInfo] objectForKey:@"NSTextMovement"] integerValue];



...


corbin _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: disable small toolbar option
  • Next by Date: Re: Single column NSListView bug?
  • Previous by thread: Re: disable small toolbar option
  • Next by thread: Re: NSTableView and displaying c strings
  • Index(es):
    • Date
    • Thread