Re: Selecting submenu root
Re: Selecting submenu root
- Subject: Re: Selecting submenu root
- From: Benoit Widemann <email@hidden>
- Date: Sun, 30 Jun 2002 17:33:35 +0200
At 9:27 -0500 30.06.02, Brian Webster wrote:
But the problem is, how to get a MenuRef from a NSMenu?
If you're working on the main menu bar, you can probably avoid using
private API by calling the Carbon function AcquireRootMenu(), which
will give you a a MenuRef for the main menu. You can then navigate
the menu hierarchy from there.
Unfortunately this only reverses the problem: I have no way to match
my NSMenu among the existing Carbon menus. Anyway, the private call
works fine, so I'll leave the question open. :-)
There is a secondary problem, which, as far as I could find, has not
been mentioned in the archives (I'm getting careful). The Carbon menu
is not created when the Cocoa menu is created, but only the first
time the menu is actually dropped down. Until that moment, the
private call returns nil.
This reminds me of another topic recently discussed, about the long
time it can take for a complicated menu to drop down the first time
it appears. It looks like the whole thing is created only when [if]
it's really needed.
I guess it makes sense, but the Cocoa API is badly missing a call to
force the pre-building (and pre-imaging) of the menu, when that's
what's wanted by the developer. This is an extra sluggish-feeling for
the user that could be easily avoided.
Benoit Widemann
_______________________________________________
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.