• 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: Changing NSTableView cell editing behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing NSTableView cell editing behaviour


  • Subject: Re: Changing NSTableView cell editing behaviour
  • From: Allan Odgaard <email@hidden>
  • Date: Tue, 2 Mar 2004 20:38:23 +0100

On 2. Mar 2004, at 19:17, Christoph Priebe wrote:

if I finish editing a string in a NSTableView cell by pressing
the return key the next cell is selected for editing. I would like to
change this default behaviour to just end the editing.
But how do I achieve this?

I don't think there is a nice way to do this, but I have subclasses my table view and implement the textDidEndEditing: delegate method (delegate for the field editor, which is used to edit the actual cells).

To abort the editing I do the following:

// what made editing stop?
int movement = [[[aNotification userInfo] objectForKey:@"NSTextMovement"] intValue];
// pass on info to superclass, which will advance the field editor
[super textDidEndEditing:aNotification];

// was the movement a return?
if(movement == NSReturnTextMovement)
{
// abort editing
[self abortEditing];
// aborting has the strange side-effect of making the table view loose focus, so we re-activate it
[[self window] makeFirstResponder:self];
}

If anyone has a better solution, I would be delighted to know about it!

Likewise, I would love to be able to abort editing on escape (i.e. revert to the state before editing started), but have not been able to do that (I guess I would need to replace the field editor for the table view, but that is really too much work).
_______________________________________________
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: Changing NSTableView cell editing behaviour
      • From: Christoph Priebe <email@hidden>
    • Re: Changing NSTableView cell editing behaviour
      • From: Dustin Voss <email@hidden>
References: 
 >Changing NSTableView cell editing behaviour (From: Christoph Priebe <email@hidden>)

  • Prev by Date: Re: How to obtain the processor temperature?
  • Next by Date: Checking if a menu is visible??!?!?
  • Previous by thread: Changing NSTableView cell editing behaviour
  • Next by thread: Re: Changing NSTableView cell editing behaviour
  • Index(es):
    • Date
    • Thread