home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 13015 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  2.2 KB

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