I have a NSViewController which I manually put into the responder-chain by calling
self.nextResponder = self.view.nextResponder;
self.view.nextResponder = self;
When the user presses keys inside the view, I am able to successfully receive keyDown: messages. However, for some reason I'm not receiving tryToPerform:with: and validateMenuItem: messages when the user access the MainMenu bar. What am I missing here?
Turns out that actually a
respondsToSelector:message is being sent first before thevalidateMenuItem:is being called. And if theNSViewControllerdoesn't actually respond to the message, thevalidateMenuItemnever quite gets called. That said, in the whole process I never sawtryToPerform:with:getting called at all. Not sure why, going to look into Cocoa's Event Programming guide and report back.