Re: Updating menubars, what exactly does setMainMenu do?
Re: Updating menubars, what exactly does setMainMenu do?
- Subject: Re: Updating menubars, what exactly does setMainMenu do?
- From: Fritz Anderson <email@hidden>
- Date: Thu, 21 Aug 2003 10:03:09 -0500
- Resent-date: Thu, 21 Aug 2003 10:06:55 -0500
- Resent-from: Fritz Anderson <email@hidden>
- Resent-message-id: <email@hidden g>
- Resent-to: email@hidden
This probably doesn't work because Cocoa has been repurposed to support
the Aqua user interface, in which there is a single, stable menu bar.
Swapping the whole menu bar in and out as windows appear or are
selected isn't supposed to happen in a Macintosh program, and Apple
probably hasn't maintained the vestigial functionality to make it
happen.
If you want to hack that behavior into a Cocoa application, I suppose
you could do it through setMainMenu: at NSWindow's BecomeKey and
ResignKey notifications. You have to handle ResignKey in order to fall
back to a useful menu bar when no window is visible.
-- F
On Tuesday, 19 August 2003, at 10:50 AM, David Elliott wrote:
In wxCocoa when a menubar is attached to a top-level window I call
[NSResponder -setMenu:] on the NSWindow object to attach the menubar
to that window.
That seems to work if it is done before the window is displayed.
Cocoa apparently makes it the main menu when the NSWindow becomes key.
However, if I try to set the menu while the window is key then I find
that it doesn't change the active menubar.
I've thought of simply calling setMainMenu on the shared application
object since it seems that is what NSApplication is doing when the
window is made key. Assuming I do that, what happens when some other
window is made key? Does NSApplication always change out the menubar
if it is switching to an NSWindow that has one?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.