1
votes

I have changed my Print menu item to send the -printWindow: message to First Responder and defined that method on two of my window controllers (my primary and a secondary window). On my primary window, everything works fine. However, when I focus on the second window the Print menu item is being automatically disabled.

@interface SecondaryWindowController : NSWindowController {

}

- (IBAction) printWindow:(id)sender;

My implementation:

- (IBAction) printWindow:(id)sender {
    NSLog(@"called print:%@", sender);
}

If I understand auto validation of menu items, it should climb up the first responder hierarchy looking for an object that responds to the chosen selector... which should be my SecondaryWindowController, but the menu item is disabled. Any idea what I'm doing wrong?

1

1 Answers

2
votes

It turned out that I needed to connect the delegate outlet of the window to File's Owner (my Window Controller). Then the menus were able to autovalidate properly and the menu item is enabled.