home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!comp.vuw.ac.nz!canterbury.ac.nz!cantua!misc042
- From: misc042@cantua.canterbury.ac.nz (Mr M J Miller)
- Subject: Re: Beginner's Hierarchical Menu Problem
- Message-ID: <BzLL5E.Btp@cantua.canterbury.ac.nz>
- Nntp-Posting-Host: cantua.canterbury.ac.nz
- Organization: from University of Canterbury, Christchurch, New Zealand.
- X-Newsreader: TIN [version 1.1 PL6]
- References: <BzKItx.qs@nic.umass.edu>
- Date: Mon, 21 Dec 1992 07:08:02 GMT
- Lines: 43
-
- Richard J. Resnick (rjr@titan.ucc.umass.edu) wrote:
- > I am returning to the Mac environment, and getting stuck (as usual) on
- > what seem to be trivialities.
- >
- > I am trying to make a simple FONT menu, which will be a hierarchical
- > menu under a menu called SPECIAL. I built the resources correctly, and
- > the FONT menu, res_id = 100, was built empty in the resource editor,
- > so that I could call AddResMenu to load it up.
- >
- > My code looks something like this:
- >
- > (*Loads up the Desk Accesories in the Apple Menu*)
- > aMenu := GetMHandle(APPLE_MENU_ID);
- > AddResMenu(aMenu, 'DRVR');
- >
- > (*Tries to load up the Fonts in the FONT_MENU*)
- > aMenu := GetMHandle(FONT_MENU_ID);
- > InsertMenu(aMenu, -1);
- > AddResMenu(aMenu, 'FONT');
- >
- > The error that I get when I run this under Think Pascal is "Think
- > Pascal unexpectedly quit", and when I build the application and run
- > it, I get a missing coprocessor error. I didn't think that any of
- > these routines called for a coprocessor!!
-
- First, use the tracing features of think pascal to find exactly where
- things go weird.
-
- Second, I probably am very wrong but I think the call:
- hMenu := GetMHandle(menuID); should be called first to LOAD the menu
- the call hMenu := GetMHandle(menuID); will simply give you a handle to
- that loaded resource (also use GetMHandle when using GetNewMBar).
-
- Third, I think the addresmenu bit should be before insertmenu, perhaps
- using a dummy menu just for this purpose (I am probably worng).
-
- Have fun...
-
- Martin Miller.
- (I am no way employed by,
- or a spokesperson of
- the University of Canterbury).
-
-