[comp.sys.mac.programmer] Problem with menu resources.

rcb@rti.UUCP (Randy Buckland) (09/02/88)

I recently had a problem in LSC 3.0 with a program trying to load
menu resources. What I have is as follows, an apple menu id #1,
a file menu id #2 and an edit menu id #3. THe resource file where these
live has them set to preload. I also have an MBAR resource #1 that 
references menus 1, 2 and 3 and is set to preload.

When running, I run under the debugger and get to macsbug before anything
gets done. The menu and mbar resource are there and correct. I step through
my program to the point where I am loading the menu resources. I make a
call of the form:

	menu_bar = GetNewMBar(1);

and then I jump back into macsbug to check things out. At this point,
the MENU resource #1 is no longer there, but appears to have been freed.

If I change the resource file to not preload the resources, after the
above call, nothing shows up on the heap.

I changed my code to not use the mbar resource, but to explicitly load the
menus and build a menu bar with InsertMenu. When I do this I still get a
strange behaviour. THe menu resource are not set to preload and when I
load them with GetMenu, the apple menu (id #1) does not show up on the
heap dump. The heap is from 0x50000 to 0xa0000 and the apple menu's handle
has an address on the order of 0xc0000 while the other menus are on the
order of 0x51000. With the method, the data appears to be there and everything
seems to be working, I just don't understand where the apple menu 
structure is being stored.

Any ideas?

-- 
					Randy Buckland (919)-541-7103
					Research Triangle Institute
					rcb@rti.rti.org [128.109.139.2]
					{decvax,ihnp4}!mcnc!rti!rcb

shane@chianti.cc.umich.edu (Shane Looker) (09/02/88)

In article <2426@rti.UUCP> rcb@rti.UUCP (Randy Buckland) writes:
>I recently had a problem in LSC 3.0 with a program trying to load
>menu resources. What I have is as follows, an apple menu id #1,
>a file menu id #2 and an edit menu id #3. THe resource file where these
>live has them set to preload. I also have an MBAR resource #1 that 
>references menus 1, 2 and 3 and is set to preload.
>
>Any ideas?
>-- 
>					Randy Buckland (919)-541-7103


As a matter of fact, I might...

Check with ResEdit to see if the menu ID is set correctly IN the resource.
The menu ID (which is the first thing at the top when editing a Menu), should
match the Resource ID.  They are distinct.  I keep forgetting this and my
menus never load when it is wrong.
 
Shane Looker
Looker@um.cc.umich.edu