home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / acorn / tech / 1168 < prev    next >
Encoding:
Text File  |  1993-01-06  |  4.1 KB  |  86 lines

  1. Newsgroups: comp.sys.acorn.tech
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!news.Hamburg.Germany.EU.net!okrumnow
  3. From: okrumnow@mcshh.Hanse.DE (Olaf Krumnow)
  4. Subject: Glass template file format
  5. Organization: Point of Presence & MCS Hamburg
  6. Date: Wed, 6 Jan 1993 10:15:52 GMT
  7. Message-ID: <okrumnow.726315352@mcshh.hanse.de>
  8. Sender: news@mcshh.Hanse.DE (News Administrator)
  9. Lines: 75
  10.  
  11. This posting is on request of Herbert zur Nedden.
  12. I will forward any replies to him.
  13.  
  14. -----------------------------------------------------------------
  15. Not very short but less than 1% quoted from other sources :-).
  16.  
  17. I like Tim Browse's ideas. Here are a few of mine as for 'how does the program
  18. use the tags and where are they stored ...'
  19.  
  20. I've been thinking about named menu items quite a while since it is easier to
  21. write programs reacting to a menu selection "QUIT" instead of "item no. 3".
  22. This is especially true when you insert a new menu item ... renumber!
  23. The SWI Wimp_DecodeMenu is not worth alot if you want to write applications
  24. using the MessageTrans module for internationalisation.
  25.  
  26. In my solution I decided that each menu item has a tag which
  27. - is the tag for the MessageTrans module, i.e. the text displayed is
  28.   read from the message file.
  29. - gives the item a name you can use in the program.
  30.  
  31. When creating the menu structure for the SWI Wimp_Createmenu the tags are
  32. stored directly after the last item of the menu, prefixed by an eyecatcher.
  33. The eyecatcher is to make sure that whatever resides after the menu in
  34. memory is not misunderstood, i.e. to be able to detect menus whose items
  35. don't have tags. That can be the case for color selection menus since
  36. tags aren't really needed for these.
  37.  
  38. Instead of the SWI Wimp_DecodeMenu a function decodes the block returned
  39. by Wimp_Poll and returns several informations:
  40. - The path based on the tags
  41. - The tag of the selected item
  42. - The level where the selection occured.
  43. - A pointer to the item in the menu structure (e.g. for setting the tag).
  44. Menu items without tags are given numeric names 0000, 0001, ....
  45.  
  46. The path is not stored as a long string but as an array of item names. Nor-
  47. mally the path isn't needed as a whole so why construct that long a string.
  48. Another function can be used to locate a menu item using the item's tag only.
  49. Well to be precise two of them are needed: FindFirst and FindNext just in
  50. case the item's tag is not unique.
  51.  
  52. I didn't give the menu itself a name. Basically since there is only one active
  53. at one time anyhow; so what for? On the other hand each sub menu is a menu
  54. as well leading to the question: 'shall sub menus have names'. If this is
  55. answered with yes, well what do you store in the path. The name of the top-
  56. most menu and the tags thereafter? Or are the submenu names included as well?
  57.  
  58.  
  59. Maybe for windows something like this can be adopted as well. It is a little
  60. more complicated since icons can be added while a window is open, but those
  61. icons probably are not the problem anyhow. But storing the tags in memory
  62. somewhere where they can be found would be nice.
  63.  
  64. I'm neither into using the RiscOsLib nor the DeskLib - I stick to the GagLib
  65. (the C library being written by Olaf Krumnow and me, GAG being the abbrevia-
  66. tion of German Archimedes Group). Therefore it would be nice to be able to
  67. implement Glazier-Templates in our libray as well. Perhaps you or someone
  68. else could write a module to offer Gazier_Template-SWIs as replacement of
  69. the Wimp_Template-SWIs which load them in memory in a decent way, i.e. so
  70. that the program can start using them right away and not as e.h. with normal
  71. templates has to get storage for the indirected buffers ...
  72.  
  73. Herbert zur Nedden
  74.  
  75. ------------------------------------------------------------------------------
  76.  
  77. Olaf.
  78.  
  79. ------------------------------------------------------------
  80. Olaf Krumnow                 e-mail: okrumnow@mcshh.hanse.de
  81.                              snail : August-Bebel-Str. 102c
  82. Headquarter of the                   W-2050 Hamburg 80
  83. German Archimedes Group              Germany
  84. ------------------------------------------------------------
  85.  
  86.