home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!ucsbcsl!mcl!scott
- From: scott@mcl.ucsb.edu (Scott Bronson)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Literals as Opposed to Constants for Menu Handling
- Message-ID: <scott.712023514@mcl>
- Date: 25 Jul 92 00:18:34 GMT
- References: <1992Jul18.104355.12995@reed.edu>
- Sender: root@ucsbcsl.ucsb.edu
- Lines: 38
-
- In <1992Jul18.104355.12995@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
-
- >Your code wants your menus to be in one language, and your users want your
- >menus to be in their language. So why not just have two menus? An easy
- >replacement for the MBAR resource can let you specify one menu for literals
- >and another for show. There's not much to reading them in, installing only
- >the local menus in the menu bar. When you get a command, get the equivalent
- >item from the literal menu, and deal with it. The special case for the
- >literal language being the same as the local language is easy.
-
- >So, what's the fatal flaw in this scheme?
-
- No fatal flaw that I can see, but personally I think that I would
- find a more straightforward way. I would use the Menu Manger like
- it was written for (one menu bar) with only minor additions for
- internationalization and your own use.
-
- My suggestion would be to implement a scheme like the THINK Class
- library uses for menus. Follow each menu item with # sign (or
- whatever you want it to be) then a command number. This actually
- turns out to be surprisingly easy to implement.
-
- Right now I have some code that hasn't been stress tested yet, but it
- does work. It translates command numbers into a run-time command
- look-up table, then automatically processes MenuSelect. You simply
- set up a switch statement to handle the command numbers you specify.
- One of these days I'm going to have this code self-send an apple
- event so that to add a menu command, you simply add the menu item
- then the handler for the apple event.
-
- The beauty of this system is that you can have your menus ANYWHERE
- in the menu bar and they will be automatically processed. If you
- really can't figure this out for yourself I'm happy to give hints,
- but my code isn't ready to be released yet for public consumption.
-
- Just a thought. I think this scheme might suit your needs better.
-
- - Scott
-