Re: deleting outline rows using a delegate
Re: deleting outline rows using a delegate
- Subject: Re: deleting outline rows using a delegate
- From: Julian Barkway <email@hidden>
- Date: Mon, 17 Jun 2002 18:13:51 +0200
On Monday, June 17, 2002, at 09:58 am, Cryx wrote:
I thought I knew how to do this with a subclass, however it appears
that something is hijacking the responder chain. I successfully
rehijacked the responder chain, but I really think I'm cheating:
@implementation MyOutlineView
- (void)keyDown:(NSEvent *)event {
consumedKeyDown = NO;
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
if (consumedKeyDown == NO) [super keyDown:event];
}
- (void)doCommandBySelector:(SEL)selector {
consumedKeyDown = [self tryToPerform:selector with:nil];
}
- (void)deleteBackward:(id)sender { /* remove item from outline */ }
- (void)deleteForward:(id)sender { /* remove item from outline */ }
@end
How may I properly utilize the responder chain to achieve this same
result?
I've successfully done somehing similar (although I did it a slightly
sneakier way - I directly overrode NSResponder's keyDown: with a
category and then implemented the desired behaviour in my table and
outline views' delegates). I think your problem might be where you're
invoking 'interpretKeyEvents:'. This should be your default 'if all else
fails' option. This is what I did:
- (void) keyDown: (NSEvent *) theEvent
{
BOOL handled = NO;
switch ([theEvent keyCode]) {
case kReturnKeyCode:
handled = [self handleReturnKey];
break;
// other keys handled here...
default:
handled = NO;
}
if ( ! handled)
[self interpretKeyEvents: [NSArray arrayWithObject: theEvent]];
}
There are probably other (more elegant) solutions but this works for me!
Cheers,
Julian Barkway.
_______________________________________________
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.