Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!orstcs!coil!jasmerb
From: jasmerb@coil.cs.orst.edu (Bryce Roger Jasmer)
Newsgroups: comp.sys.mac.programmer
Subject: Heirarchical Menus and Menu Definitions
Message-ID: <5381@orstcs.CS.ORST.EDU>
Date: 5 Jul 88 07:01:59 GMT
Sender: netnews@orstcs.CS.ORST.EDU
Lines: 33

I am having serious trouble getting my own menu definition working in a 
submenu. The menu definition will work all by itself when it is regular
menu in the menubar, and the heirarchical menu works just fine with a
standard menu attached as a submenu, but when the two are combined they
won't work.

I am using LSP and here is some of the code to create the menu:

TopLevelMenu := GetMenu(TopLevelMenuID);  
tempString := ConCat(chr(hMenuCmd), chr(SubMenuID), 'SubMenu');
AppendMenu(TopLevelMenu, tempString);	
InsertMenu(TopLevelMenu, 0);

SubMenu := GetMenu(SubMenuID);
SubMenu^^.menuProc := NewHandle(0);	
SubMenu^^.menuProc^ := Ptr(@SubMenuProc);   {defined elsewhere}
InsertMenu(SubMenu, -1);
CalcMenuSize(SubMenu);

-------

I will click in the TopLevelMenu and drag down to the 'SubMenu' item,
the Mac then draws the empty box that the my submenu will draw in, and
then crashes at the "MenuSelect(theEvent.where)" function call.

I would compile the menu definition into a MDEF resource but the menu
definition needs to have access to some global data.

Please send e-mail, I am desperate! I will summarize if the solution
comes my way. Thank you VERY much.

Bryce Jasmer
jasmerb@coil.cs.orst.edu