Search code examples
objective-ccocoaappkitnstextfieldcell

How to end editing in NSTextFieldCell inside NSOutlineView after ESC key is pressed


I'm trying to get a custom NSTextFieldCell (inside a NSOutlineView) to end editing when the ESC key is pressed but cannot find any way to accomplish this. I tried to add an observer for the NSControlTextDidChangeNotification-notification but it is not fired for the ESC-key nor is keyDown fired in the NSOutlineView.


Solution

  • Esc triggers -cancelOperation in NSResponder. You can try to handle this somewhere in your responder chain.