home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / hypercar / 4708 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  2.5 KB

  1. Path: sparky!uunet!usc!howland.reston.ans.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!sable.cars.com!shawn
  2. From: shawn@cars.com (Shawn Connelly)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: Menu Question
  5. Date: Mon, 4 Jan 93 13:18:21 EST
  6. Organization: Connelly Automation Research and Services
  7. Message-ID: <01050023.mrqcsj@sable.cars.com>
  8. Reply-To: shawn@cars.com
  9. X-Mailer: uAccess - Macintosh Release: 1.6v1
  10. Lines: 53
  11.  
  12.  
  13. In article <103422@netnews.upenn.edu> (comp.sys.mac.hypercard), gasser@eniac.seas.upenn.edu (Nathan Gasser) writes:
  14. > >> I have made my own menus in the menubar and I was wondering
  15. > >> how to enable them.
  16. > >you have to write a "domenu" handler 
  17. > >on domenu What
  18. > >  if what = "your menuitem" then
  19. > >    your commands
  20. > >    exit domenu
  21. > >  end if
  22. > >  if what =  "Your next menuitem" then
  23. > >    your commands
  24. > >    exit domenu
  25. > > end if
  26. > > pass domenu
  27. > >end domenu
  28. > [...]
  29. > >it is also possible to use menuMessage when you create the menu, but
  30. > >I think that domenu is easier if you do it for the first time.
  31. > I really think the menuMessage approach is a thousand times better,
  32. > and it's not hard at all:
  33. > on menuInstall
  34. >   if there is a menu "Jokes" then delete menu "Jokes"
  35. >   create menu "Jokes"
  36. >   put "Knock-Knock" into menu "Jokes" with menuMessage "doKnock"
  37. >   put "Limericks"  after menu "Jokes" with menuMessage "doLimerick"
  38. >   put "Light Bulb" after menu "Jokes" with menuMessage "doBulb"
  39. >   [...]
  40. > end menuInstall
  41. > Then when someone chooses a menu item, the cooresponding menuMessage
  42. > handler is issued.  You can only have a 1 line command for each menu item,
  43. > though.  Just make handlers to do what you want for each item.
  44. > Trapping doMenu is no fun, nor is a mile-long if-then-else.  
  45.  
  46. There's an undocumented feature with menuMessage's though. You cannot
  47. have any more than 20 menuMessages. For this reason, I always trap
  48. and use on doMenu. Yes, I have mile-long if0then-else statements, but
  49. maybe this could be solved with a 'case' statement in the next version
  50. of HC, not to mention the restirction previously mentioned.
  51.  
  52. ------------------------------------------------------------------------
  53. Shawn Connelly                          |  Go Colorado Rockies!
  54. Connelly Automation Research & Services |   The only undefeated team
  55. P.O. Box 720442                         |    in the Nat'l League West!
  56. Atlanta, GA 30358-2442                  |
  57. Internet: shawn@cars.com or shawn@csn.org; UUCP: ...!csn!sable!shawn
  58.