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