home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20130 next >
Encoding:
Text File  |  1992-12-21  |  2.0 KB  |  56 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!comp.vuw.ac.nz!canterbury.ac.nz!cantua!misc042
  3. From: misc042@cantua.canterbury.ac.nz (Mr M J Miller)
  4. Subject: Re: Beginner's Hierarchical Menu Problem
  5. Message-ID: <BzLL5E.Btp@cantua.canterbury.ac.nz>
  6. Nntp-Posting-Host: cantua.canterbury.ac.nz
  7. Organization: from University of Canterbury, Christchurch, New Zealand.
  8. X-Newsreader: TIN [version 1.1 PL6]
  9. References: <BzKItx.qs@nic.umass.edu>
  10. Date: Mon, 21 Dec 1992 07:08:02 GMT
  11. Lines: 43
  12.  
  13. Richard J. Resnick (rjr@titan.ucc.umass.edu) wrote:
  14. > I am returning to the Mac environment, and getting stuck (as usual) on
  15. > what seem to be trivialities.
  16. > I am trying to make a simple FONT menu, which will be a hierarchical
  17. > menu under a menu called SPECIAL. I built the resources correctly, and
  18. > the FONT menu, res_id = 100, was built empty in the resource editor,
  19. > so that I could call AddResMenu to load it up.
  20. > My code looks something like this:
  21. > (*Loads up the Desk Accesories in the Apple Menu*)
  22. >   aMenu := GetMHandle(APPLE_MENU_ID);
  23. >   AddResMenu(aMenu, 'DRVR');
  24. > (*Tries to load up the Fonts in the FONT_MENU*)
  25. >   aMenu := GetMHandle(FONT_MENU_ID);
  26. >   InsertMenu(aMenu, -1);
  27. >   AddResMenu(aMenu, 'FONT');
  28. > The error that I get when I run this under Think Pascal is "Think
  29. > Pascal unexpectedly quit", and when I build the application and run
  30. > it, I get a missing coprocessor error. I didn't think that any of
  31. > these routines called for a coprocessor!!
  32.  
  33. First, use the tracing features of think pascal to find exactly where
  34. things go weird.
  35.  
  36. Second, I probably am very wrong but I think the call:
  37. hMenu := GetMHandle(menuID); should be called first to LOAD the menu
  38. the call hMenu := GetMHandle(menuID); will simply give you a handle to
  39. that loaded resource (also use GetMHandle when using GetNewMBar).
  40.  
  41. Third, I think the addresmenu bit should be before insertmenu, perhaps
  42. using a dummy menu just for this purpose (I am probably worng).
  43.  
  44. Have fun...
  45.  
  46. Martin Miller.
  47. (I am no way employed by,
  48.     or a spokesperson of
  49.         the University of Canterbury).
  50.  
  51.