home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / hypercar / 4687 < prev    next >
Encoding:
Internet Message Format  |  1992-12-30  |  1.6 KB

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!jvnc.net!netnews.upenn.edu!eniac.seas.upenn.edu!gasser
  2. From: gasser@eniac.seas.upenn.edu (Nathan Gasser)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: Menu Question
  5. Message-ID: <103422@netnews.upenn.edu>
  6. Date: 30 Dec 92 20:36:50 GMT
  7. Sender: news@netnews.upenn.edu
  8. Lines: 44
  9. Nntp-Posting-Host: eniac.seas.upenn.edu
  10.  
  11. >> I have made my own menus in the menubar and I was wondering
  12. >> how to enable them.
  13.  
  14. >you have to write a "domenu" handler 
  15. >on domenu What
  16. >  if what = "your menuitem" then
  17. >    your commands
  18. >    exit domenu
  19. >  end if
  20. >  if what =  "Your next menuitem" then
  21. >    your commands
  22. >    exit domenu
  23. > end if
  24. > pass domenu
  25. >end domenu
  26. [...]
  27. >it is also possible to use menuMessage when you create the menu, but
  28. >I think that domenu is easier if you do it for the first time.
  29.  
  30.  
  31. I really think the menuMessage approach is a thousand times better,
  32. and it's not hard at all:
  33.  
  34. on menuInstall
  35.   if there is a menu "Jokes" then delete menu "Jokes"
  36.   create menu "Jokes"
  37.   put "Knock-Knock" into menu "Jokes" with menuMessage "doKnock"
  38.   put "Limericks"  after menu "Jokes" with menuMessage "doLimerick"
  39.   put "Light Bulb" after menu "Jokes" with menuMessage "doBulb"
  40.   [...]
  41. end menuInstall
  42.  
  43. Then when someone chooses a menu item, the cooresponding menuMessage
  44. handler is issued.  You can only have a 1 line command for each menu item,
  45. though.  Just make handlers to do what you want for each item.
  46.  
  47. Trapping doMenu is no fun, nor is a mile-long if-then-else.  
  48.  
  49. Nate.
  50. --
  51.  
  52. Nathan Gasser       ><>         
  53. gasser@eniac.seas.upenn.edu     
  54.  
  55.