I'm afraid I'm a little slow on the
uptake with your answer, and I tried passing a 0 to every function
that required a menuID - but I couldn't get it to run.
That's because
SetMenuItemHierarchicalMenu() doesn't take a menu id. It takes
a MenuItemIndex, you're passing 0, which isn't a valid index in this
case.
Notice the text you quoted from the Menu Manager Reference and
the sample code you pasted. The sample code correctly passes an index
(4). The index is the menu item you want to attach the submenu
to.
First, I make a new project : a Carbon
C++ Application
Then I open main.cpp, and I paste the
code I sent the list before, (or the latest version which is below) -
at line 13,
and I add a line at MainWindow::Create
(which is now line 80), calling the new function.
MenuTest();
One thing I can tell you is that if you
do it this way, you need to set up your windows etc before you
instantiate your MainWindow class.
So
MenuTest();
goes above
MainWindow* wind = new
MainWindow();
If you don't, you will get no menus and
no explanation!
I press command-y, the project compiles
and begins debugging, the window appears, and the menuitems entered at
root level work as expected, I click them and down drops a submenu.
That works.
(screenshot removed, but I have it if you need proof that i
can run it without errors)
In the picture above, I have clicked the
"Special" menu, and nothing dropped down, rather
disappointingly :(
FYI,
Discussion
Using
SetMenuItemHierarchicalMenu, it is
possible to directly specify the submenu for a menu item without
specifying its menu ID. It is not necessary to insert the submenu into
the hierarchical portion of the menubar, and it is not necessary for
the submenu to have a unique menu ID. Simply use 0 as the menu ID for
the submenu, and identify selections from the menu by command
ID.
(from the Menu Manager Reference, ADC Oct
06) -
SetMenuItemHierarchicalMenu
Here is a slightly different, but not
working, version of the generic menu maker... this is what I pasted
into line 13 of main.cpp (I didn't do anything else to the boilerplate
c++ application that xcode built for me)
--
Sincerely,
Rosyna Keller
Technical Support/Carbon troll/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden