• 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: deleting outline rows using a delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: deleting outline rows using a delegate (From: Cryx <email@hidden>)

  • Prev by Date: Re: Unwanted transparency in custom view
  • Next by Date: Rotated display of bitmap images?
  • Previous by thread: Re: deleting outline rows using a delegate
  • Next by thread: [ANN] Reminder: Foundation Collections Palette
  • Index(es):
    • Date
    • Thread