3
votes

I am creating an OS X application with multiple windows. The main window appears in the Window menu as expected.

I'm creating the 2nd NSWindow using initWithWindowNibName. It appears as expected when I call showWindow. However the window doesn't show up in the Window menu (under "Bring all to front" and the main window's name).

I tried:

[[NSApplication sharedApplication] addWindowsItem:[winController window] 
                                                title:@"The Window" 
                                                filename:NO];    }

I also tried:

[[winController window] setExcludedFromWindowsMenu:NO]; 

Neither of these seemed to help.

If you can't tell, I'm new to OS X (but I know Obj-C relatively well).

2

2 Answers

2
votes

I figured it out. I was creating the window in a NSResponder's init function. Somehow it was happening too early and the sharedApplication wasn't ready yet. When I moved the window creation into an awakeFromNib everything worked as expected.

1
votes

The Window Programming Guide says that "This menu automatically lists windows that have a title bar and are resizable and that can become the main window". Is there a reason that this window cannot become main, e.g., is it an NSPanel?