home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / acorn / tech / 1180 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  5.7 KB

  1. Path: sparky!uunet!wupost!waikato.ac.nz!aukuni.ac.nz!cs18.cs.aukuni.ac.nz!jwil1
  2. Newsgroups: comp.sys.acorn.tech
  3. Subject: Re: Glass template file format
  4. Message-ID: <1993Jan7.211113.16569@cs.aukuni.ac.nz>
  5. From: jwil1@cs.aukuni.ac.nz (TMOTA)
  6. Date: Thu, 7 Jan 1993 21:11:13 GMT
  7. Sender: jwil1@cs.aukuni.ac.nz (TMOTA)
  8. References: <okrumnow.726315352@mcshh.hanse.de>
  9. Organization: Computer Science Dept. University of Auckland
  10. Lines: 108
  11.  
  12. okrumnow@mcshh.Hanse.DE (Olaf Krumnow) writes:
  13.  
  14. >I've been thinking about named menu items quite a while since it is easier to
  15. >write programs reacting to a menu selection "QUIT" instead of "item no. 3".
  16. >This is especially true when you insert a new menu item ... renumber!
  17. >The SWI Wimp_DecodeMenu is not worth alot if you want to write applications
  18. >using the MessageTrans module for internationalisation.
  19.  
  20. ...not to mention that DecodeMenu never seems to work properly with
  21. indirected menu items (fixed in RO3.10?)
  22.  
  23. >In my solution I decided that each menu item has a tag which
  24. >- is the tag for the MessageTrans module, i.e. the text displayed is
  25. >  read from the message file.
  26. >- gives the item a name you can use in the program.
  27.  
  28. Well, the idea with Glazier is to suply an editor, a file format, and also
  29. som code libraries to support the new formats. Thus, we can get *right*
  30. away from standard menu definitions for the file format, and supply code
  31. to handle menu-template loading for you.
  32.  
  33. Things that the menu template system should provide:
  34.  * Tagged menu items so that menu action is unrelated to the text displayed
  35.    in an item, and also to the position of the item in the menu tree.
  36.    (i.e. the user can move 'quit' from the main menu onto another menu
  37.     so that it is now 4 submenus deep, and it should still work)
  38.  * Automaytic handling by the support code of creating menus when required.
  39.    By mixing and matching tagged menu items, you can build different menus
  40.    from pre-defined items (so you can add/delete items as necessary)
  41.  * Automatic creation/addition of submenus/ssubwindows
  42.  * support for creation of menus such as are made on the fly (e.g. font list)
  43.  * support for 'tickable' menu items, with ESG groups.
  44.  * support for proper shading of items and submenus
  45.    (i.e. if an item with a submenu off it is shaded, the submenu should
  46.    still pop up, only be totally shaded, as in Acorn Style Guide)
  47.  * support for a keypress handler that will act as if a menu selection jhas
  48.    been made for certain keypresses: These key bindings are user-editable.
  49.  * While we're at it, a proper key-binding scjheme, so ALL key bindings
  50.    for the entire application can be edited.
  51.  
  52. This will differ significantly from Wimp menu structures on disc, but can
  53. be quite efficiently stored and converted into menu structures on the fly.
  54. (I've already done it, and it works)
  55.  
  56. This allows total control of the menu interface from !Glazier.
  57.  
  58. The easiest way I can see to handle menu decoding is that in your event handler
  59. you place calls to predefined functions whenever you get a menu hit or
  60. keypress event you can't handle:
  61.  
  62.   menutag = DecodeMenu(event_block);
  63.   if (menutag != NULL)
  64.     ActionAMenuChoice(menutag);
  65.  
  66. ...so the DecodeMenu function will decode what the click meant, and pass
  67. back a tag 'quit' 'info' etc. to indicate which item was selected. (It can
  68. of course, weed out clicks on pseudo-shaded items and tickable items
  69. if you don't want ot know about them).
  70.  
  71. For keypresses, the same thing:
  72.  
  73.   menutag = DecodeKeyPress(event_block);
  74.   if (menutag != NULL)
  75.     ActionAMenuItem(menutag);
  76.  
  77. ...the function ActionAMenuItem() is a user function with a switch statement
  78. in it which decodes the tag and takes appropriate action.
  79.  
  80. NOTE that I'm only using 1 tag here, because unless every menu item has a
  81. unique tag, you lose position independance: You shouldn't specify a
  82. tag as menu.submenu.item unless you really have to, or it locks the user
  83. into having to leave that item in that submenu...
  84.  
  85. >- The level where the selection occured.
  86. >- A pointer to the item in the menu structure (e.g. for setting the tag).
  87. >Menu items without tags are given numeric names 0000, 0001, ....
  88.  
  89. Nope... just provide calls to alter the state of the current menu.
  90.  
  91. >The path is not stored as a long string but as an array of item names. Nor-
  92.  
  93. Nope. As I mentioned above, a path is a bad thing. It should be available,
  94. but where possible, you should only use a unique item identifier for the
  95. final selected menu item, so as to make the menu as editable as possible.
  96.  
  97. >I didn't give the menu itself a name. Basically since there is only one active
  98. >at one time anyhow; so what for? On the other hand each sub menu is a menu
  99. >as well leading to the question: 'shall sub menus have names'. If this is
  100.  
  101. Yes. Every menu has a tag. Every item has a tag. A menu consists of a list
  102. of items. Items can contain references to window tags and menu tags. for
  103. submenus...
  104.  
  105. >I'm neither into using the RiscOsLib nor the DeskLib - I stick to the GagLib
  106. >(the C library being written by Olaf Krumnow and me, GAG being the abbrevia-
  107. >tion of German Archimedes Group). Therefore it would be nice to be able to
  108. >implement Glazier-Templates in our libray as well. Perhaps you or someone
  109. >else could write a module to offer Gazier_Template-SWIs as replacement of
  110. >the Wimp_Template-SWIs which load them in memory in a decent way, i.e. so
  111. >that the program can start using them right away and not as e.h. with normal
  112. >templates has to get storage for the indirected buffers ...
  113.  
  114. Well, the way I planned to implement my menu code before !Glazier came into
  115. the scene, is totally unreliant on any library structure, so can be easily
  116. added on top of the library. But abyway, it shouldn't take much work
  117. on your part to include our source code into your own library...
  118. -- 
  119. themasterofthearcanejwil1@cs.aukuni.ac.nzthismessagewassentonrecycledelectrons
  120.