0

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];
     }

}
Willeke
  • 14,578
  • 4
  • 19
  • 47
bgdegazio
  • 19
  • 5
  • Is it possible to reproduce the issue in a small test project? – Willeke May 28 '20 at 07:25
  • Sorry, can't really do that without re-writing completely in another language. – bgdegazio May 28 '20 at 20:07
  • Is there something I can add that would explain it more clearly? – bgdegazio May 28 '20 at 21:25
  • Is the window controller the delegate of its window? – Willeke May 29 '20 at 08:56
  • `super` is not the next responder. I've seen different results if I pass my event to `super` or to the `nextResponder` You probably want something more like: `[[self nextResponder] keyDown:event];` I can't tell if that would resolve your problem or not though. – silicontrip Apr 26 '21 at 03:15

0 Answers0