Delete action from variety of key presses

2008-07-07 Thread Nathan Vander Wilt
I want to be able to delete the items selected in a view, but am struggling finding a best way to turn the different key presses into a -delete: action that my controller can handle. I think I want (it seems expected functionality anyway) the delete key, the forward delete key, as well as C

Re: Delete action from variety of key presses

2008-07-07 Thread Ken Thomases
On Jul 7, 2008, at 5:29 PM, Nathan Vander Wilt wrote: I want to be able to delete the items selected in a view, but am struggling finding a best way to turn the different key presses into a -delete: action that my controller can handle. I think I want (it seems expected functionality anyway

Re: Delete action from variety of key presses

2008-07-07 Thread Nathan Vander Wilt
The Cocoa Text Bindings system already translates keys and key combinations into invocations of NSResponder methods. So, what you need to do is determine which methods those

Re: Delete action from variety of key presses

2008-07-07 Thread Greg Titus
Hi Nathan, By overriding -keyDown: and not calling [super keyDown:keyEvent], you have stopped your view from actually processing the keys any further. That's why you aren't getting to either of the delete methods. Hope this helps, - Greg On Jul 7, 2008, at 4:59 PM, Nathan Vander Wi

Re: Delete action from variety of key presses

2008-07-07 Thread Graham Cox
The view that is first responder needs to override -keyDown: and do this: [self interpretKeyEvents:[NSArray arrayWithObject:event]]; which hooks the event into the standard dispatcher for these methods. (One thing that has long puzzled me about this though - why is the parameter an

Re: Delete action from variety of key presses

2008-07-07 Thread Randall Meadows
On Jul 7, 2008, at 6:07 PM, Graham Cox wrote: The view that is first responder needs to override -keyDown: and do this: [self interpretKeyEvents:[NSArray arrayWithObject:event]]; which hooks the event into the standard dispatcher for these methods. (One thing that has long puzzled m

Re: Delete action from variety of key presses

2008-07-07 Thread Ken Thomases
On Jul 7, 2008, at 6:59 PM, Nathan Vander Wilt wrote: Thanks, I forgot to mention that I tried overriding some of those action methods. However, I couldn't get them to fire. If I implement: - (BOOL)acceptsFirstResponder { return YES; } - (void)keyDown:(NSEvent*)keyEvent { (v

Re: Delete action from variety of key presses

2008-07-07 Thread Nathan Vander Wilt
By overriding -keyDown: and not calling [super keyDown:keyEvent], you have stopped your view from actually processing the keys any further. That's why you aren't getting to either of the delete methods. Hmm, the flowchart I mentioned (http://developer.apple.com/documentation/Cocoa/Conceptua

Re: Delete action from variety of key presses

2008-07-08 Thread Nathan Vander Wilt
On Jul 7, 2008, at 5:07 PM, Graham Cox wrote: The view that is first responder needs to override -keyDown: and do this: [self interpretKeyEvents:[NSArray arrayWithObject:event]]; which hooks the event into the standard dispatcher for these methods. (One thing that has long puzzled me

Re: Delete action from variety of key presses

2008-07-08 Thread Caleb Strockbine
On Jul 8, 2008, at 3:02 PM, [EMAIL PROTECTED] wrote: Okay, got this message late though it looks like another had responded to it already. Given that I need to override -keyDown: (or - performKeyEquivalent:) in applicable first responders anyway, and it doesn't really read well to have -forwardD