What is the proper design pattern for handling keyDown: events in a NSSplitView?

52 Views Asked by At

I would like to have separate KeyDown: handlers for each of the various subviews in a complex splitview based Window. In addition, I would like to have a "global" KeyDown: handler at the WindowController level for any keys that are not handled by the individual subview handlers.

From my understanding of the NSResponder documentation, I should be able to do something like the following: (in pseudocode - please don't complain about the syntax. I'm acually writing this Forth but I thought the objective-C style pseudocode would get the idea across better here. )

But the unhandled keys do not propagate up the responder chain to the WindowController as I expected. It appears that the chain stops at the ViewController.

What am I missing here?

thanks


(pseudocode)

- (void)keyDown:(NSEvent *)theEvent {

    IF{ certain-keys
    // subview  -- keydown event handling code responds only to certain keys.
       [mySubViewController doMysubviewKeyDown:theEvent etc 
    ELSE 
    // window controller -- keydown handling code for all other keys.
       [super keyDown:theEvent];
     }

}
0

There are 0 best solutions below