tags:

views:

26

answers:

2

I want to remove an item from my NSOutlineView when the user presses the delete key. Is the only way to do this to over-ride the keyUp method of NSResponder? I was hoping for higher level solution.

A: 

I think that overriding -keyDown: or -keyUp: in a subclass is the only way to do this.

Rob Keniger
...note that these are not equivalent; deletion should be triggered on key down, not key up.
Nicholas Riley
+3  A: 

Its possible to do this without subclassing. Set the NSOutlineView's nextResponder (using -setNextResponder:) to your controller. In the controller class you can override -keyDown: (or -keyUp: and then handle the event in your controller class.