When you let the application open a window (NSWindow), a command after the name of that window appears under the Window menu as shown below where one of the commands points to the main application window and the other points to the opened window.
Provided that I know the name of the window the user is going to show, how do I enable and disable that command? I suppose the following is not going to work.
- (void)closeGenericWindow {
NSString *windowName = NSLocalizedString(@"controlListWindow",@"");
NSMenuItem *windowMenuItem = [[NSMenuItem alloc] initWithTitle:windowName action:nil keyEquivalent:@""];
[windowMenuItem setEnabled:NO];
}
I've run a search for '[objective-c] [cocoa] disable window.' I don't find anything relevant except this topic, which suggests that I create an IBOutlet in the header. But the command itself doesn't exist until the user actually chooses to open the window in question.
Muchos thankos
