home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / d / eventshell / Docs / MenuSWIs < prev    next >
Encoding:
Text File  |  1993-09-04  |  24.7 KB  |  722 lines

  1.  
  2.  
  3.              Documentation for the MenuUtils module v.0.10
  4.  
  5.                        © Petrov Software 1992
  6.  
  7.                                 
  8.  
  9.                          Description of SWIs
  10.  
  11. SWI chunk prefix for the MenuUtils module is MenuUtil_ and base number
  12. is &45BC0. My thanks to Acorn for the allocation of SWI chunk.
  13.  
  14.           Module MenuUtils provides the following SWIs:
  15.  
  16.                         "MenuUtil_Initialise"    
  17.                         "MenuUtil_New"           
  18.                         "MenuUtil_Add"           
  19.                         "MenuUtil_Delete"  
  20.                         "MenuUtil_Decode"
  21.                         "MenuUtil_Show"    
  22.                         "MenuUtil_ShowSubMenu" 
  23.                         "MenuUtil_Info"    
  24.                         "MenuUtil_Text"    
  25.                         "MenuUtil_Tick"
  26.                         "MenuUtil_Dots"    
  27.                         "MenuUtil_Fade"    
  28.                         "MenuUtil_Warning" 
  29.                         "MenuUtil_Writable"
  30.                         "MenuUtil_SubMenu" 
  31.                         "MenuUtil_ColourMenu"  
  32.                         "MenuUtil_Colours" 
  33.                         "MenuUtil_TickOnly"
  34.  
  35. All calls to MenuUtils module (with the exception of
  36. MenuUtil_Initialise and MenuUtil_New) expect in R0 the handle of the menu
  37. or of the menu item. If the handle is omitted (R0=0) then the current menu
  38. or current menu item is assumed (interpretation depends on particular SWI).  
  39.  
  40.  
  41.  MenuUtil_Initialise (SWI &45BC0)
  42.  --------------------------------
  43.  To register the task as MenuUtils client
  44.  
  45.  Entry:
  46.      R0 last MenuUtils version number known to task * 100                
  47.      R1 initialisation type (see later)
  48.         bit 0
  49.             0 - "BASIC"
  50.             1 - "machine code" (not supported by current version)
  51.  Exit:
  52.      R0 version number * 100
  53.      R1,R2 preserved     
  54.  
  55. MenuUtil_Initialise should only be called once when the task starts up. It
  56. must be called after Wimp_Initialise has been called and before any
  57. other call to the MenuUtils module is made.
  58.  
  59. MenuUtils performs all the closedown work automatically when the
  60. task finishes so no special MenuUtil_CloseDown SWI is provided.
  61.  
  62.  Example code:
  63.  Register the task with any version of the module
  64.  SYS "MenuUtil_Initialise"
  65.  
  66.  
  67.  
  68.  MenuUtil_New (SWI &45BC1)
  69.  -------------------------
  70.  Creates new empty menu.
  71.  
  72.  Entry:
  73.      R1 pointer to menu title string
  74.      R2 approximate number of items (default 5)
  75.  
  76.  Exit:
  77.      R0 handle of created menu
  78.     
  79. This call creates new empty menu with specified title string. Colours
  80. and dimensions of the menu are in standard RISC OS style. You can
  81. specify number of items you are going to have in this menu. This is
  82. optional but it can speed up the process of menu creation. It
  83. may be important for big menus (for example for oldstyle fonts menu).
  84.  
  85. As Window Manager doesn't allow you to have menus absolutely without
  86. menu items so each new menu is created together with one special item.
  87. This item is created with the only aim to prevent crashes in case you
  88. will accidentially try to open unfinished menu. The special item will
  89. be removed automatically just after you add your first item to this
  90. menu.
  91.  
  92. If your program has complex menu structure with submenus then you can
  93. use this call to create not only main menu but also all submenus. And
  94. you have to remember the handles of all submenus in order to link them
  95. later to corresponding menu items in parent menu. If on the other hand
  96. your program have only one menu without submenus then you may ignore
  97. the returned menu handle because it will be anyway used as default in
  98. all future calls to MenuUtils.
  99.  
  100. After this call the new menu becomes the current menu.
  101.  
  102.  Example code:
  103.  Start construction of simple menu like one in Palette Utility
  104.  SYS "MenuUtil_New",,"Palette" 
  105.  
  106.  If you program has complex menu structure (like Source Editor) then you
  107. have to remember the handles of all submenus
  108.  SYS "MenuUtil_New",,"SrcEdit" TO mainMenu%
  109.  SYS "MenuUtil_New",,"Display" TO dispMenu%
  110.  SYS "MenuUtil_New",,"Fonts",200  TO fontsMenu%
  111.  
  112.            
  113.  
  114.  
  115.  MenuUtil_Add (SWI &45BC2)
  116.  -------------------------
  117.  Adds new item to existing menu.
  118.  
  119.  Entry:
  120.      R0 handle of the menu or of the menu item or zero for current menu
  121.      R1 pointer to item text
  122.      R2 pointer to item handler
  123.  
  124.  Exit:
  125.      R0 handle of menu item
  126.      R1,R2 preserved
  127.  
  128.  
  129. This call adds one item to the existing menu. If handle is the handle
  130. of menu then new item will be added to the end of this menu. If handle
  131. is the handle of the item then new item will be inserted into menu
  132. just before this item. If R0 is zero on entry then item will be added
  133. to the end of current menu.
  134.  
  135. During this call the current menu may be moved in memory so if you
  136. keep direct pointers to the menu data structure they may become
  137. invalid. On the other hand if there are any menu items linked with
  138. this menu by means of MenuUtil_Submenu then all pointers will be
  139. recalculated automatically by the module and will remain valid.
  140.  
  141. MenuUtils makes his own copy of the string pointed to by R1 but
  142. inspite of this you still can easily change it with MenuUtil_Text. If R1
  143. is zero on entry then null string ("") will be used as item text.
  144.  
  145. If R2 is not zero on entry then interpretation of it contents depends
  146. on the initialisation type specified early during the call to
  147. MenuUtil_Initialise. If initialisation type was specified as "BASIC" then
  148. it is assumed that R2 is a pointer to the ctrl-terminated text string.
  149. In this case the module makes his own copy of the string for later use
  150. in MenuUtil_Decode. If initialisation type was "machine code" (not
  151. supported by current version) then only the contents of R2 is saved by
  152. the module. This feature allows you to attach a handler to the menu
  153. item. In case of "BASIC" you can provide the name of BASIC function.
  154. In case of "machine code" - the address of ARM subroutine. See also
  155. MenuUtil_Decode and for possible use of item handlers.
  156.                
  157.  
  158.  Example code:                              
  159.  
  160.  Add item "Info" to the current menu
  161.  SYS "MenuUtil_Add",,"Info" TO infoItem%    
  162.  
  163.  Add item "Quit" and then insert item "Create" just before it.  Let's
  164. the first item will have the handler. The handler is assumed to be
  165. BASIC function FNquit. (See MenuUtil_Decode on how this handler may be
  166. called) 
  167.  SYS "MenuUtil_Add",,"Quit","quit" TO quitItem%
  168.  SYS "MenuUtil_Add",quitItem%,"Create" TO createItem%                                  
  169.  Create menu similar to Display submenu in Filer. When items are added
  170. to current menu menu handle (dispMenu%) may be omitted as it will be
  171. used by default.
  172.  SYS "MenuUtil_New",,"Display" TO dispMenu%
  173.  SYS "MenuUtil_Add",,"Large icons" TO largeItem%
  174.  SYS "MenuUtil_Add",,"Small icons" TO smallItem%
  175.  SYS "MenuUtil_Add",,"Full info" TO fullItem%
  176.  
  177.           
  178.  
  179.  
  180.  MenuUtil_Delete (SWI &45BC3)
  181.  ----------------------------
  182.  Removes menu or menu item
  183.  
  184.  Entry:
  185.      R0 = handle of the menu or of the menu item or zero for current menu
  186.      if R1<>0 then recursively delete all submenus 
  187.  Exit:
  188.      R0,R1 preserved
  189.  
  190. This call allows you to delete the whole menu or the particular menu item.
  191. If you will delete menu item then remained items of this menu which are
  192. positioned bellow it will be automatically shifted in memory to fill the
  193. hole. Despite the fact that memory location and position in menu of some
  194. items may be changed the handles of the items will remain valid.
  195.  
  196. If you want to delete not only the item but also the whole menu subtree
  197. connected with it then you must set R1<>0 on entry. If R0 contains the
  198. handle of menu then this menu will be deleted alone or together with all
  199. submenus depending on R1. 
  200.  
  201. Use recursive deletion with caution as you may accidentally delete
  202. submenus which are connected with other menu items.
  203.  
  204. This call is supposed to be used when menus with variable number of items
  205. are needed. It may be for example menu with the list of currently opened
  206. documents or archives.
  207.  
  208.  Example code:
  209.  Delete item with handle tmpItem%
  210.  SYS "MenuUtil_Delete",tmpItem%
  211.  
  212.  Recursively delete all menus linked with mainMenu%
  213.  SYS "MenuUtil_Delete",mainMenu%,TRUE
  214.      
  215.                                        
  216.  
  217.  
  218.  
  219.  
  220.  MenuUtil_Decode (SWI &45BC4)
  221.  ----------------------------
  222.  Decodes menu after user selection.
  223.  
  224.  Entry:
  225.  
  226.      R0 = menu handle or zero if current menu
  227.      R1 -> pointer to the list of menu selections
  228.  Exit:
  229.      R0 -> pointer to item handler or zero
  230.      R1 -> TRUE if selection was made with ADJUST. (undocumented, but
  231.            used in !TemplEd) 
  232.      R2 -> pointer to block (original docs said this was returned in R1 -
  233.            this appears to be incorrect!)
  234.  
  235. Block pointed to by R1 must contain the list of menu selections in the same
  236. format as returned by Wimp_Poll in case of menu selection event. 
  237.  
  238.                R1 + 0  item in main menu which was selected (starting from 0)
  239.                R1 + 4  item in first submenu which was selected
  240.                R1 + 8  item in second submenu which was selected
  241.                        ...
  242.                        terminated by -1
  243.  
  244. This call maps the list of menu selections onto menu data structure and
  245. determines corresponding menu items. Various information about last two
  246. items from this list (selected item and parent item from menu one level up
  247. if any) is written into special block. Pointer to this block is returned in
  248. R1. Format of the returned block is as follows: 
  249.  
  250.  R1+0  position of selected menu item in menu (starting from 0)
  251.  R1+4  pointer to selected item data
  252.  R1+8  selected item handle or zero if item was created without MenuUtils
  253.  R1+12 pointer to text string of selected item
  254.  R1+16 position of parent menu item in menu (starting from 0)
  255.  R1+20 pointer to parent item data
  256.  R1+24 parent item handle or zero if item was created without MenuUtils
  257.  R1+28 pointer to text string of parent item                         
  258.  
  259. If the item has been selected from the top-level menu then there will be no
  260. parent item and corresponding part of the block will be filled with zeros.                                                                                     
  261. If during creation of this item you have specified the handler then R0 on
  262. exit will contain the pointer to this handler otherwise R0 will be zero.
  263. Interpretation of item handler is determent by initialisation type (see
  264. MenuUtil_Initialise). If initialisation type was "BASIC" then R0 will point to
  265. ctrl-terminated text string. If initialisation type was "machine code" (not
  266. supported by current version) then R0 will contain the value passed in R2 to
  267. MenuUtil_Add. To invoke BASIC handler you can use EVAL statement.
  268.  
  269. Example code:
  270.  Suppose Wimp_Poll has returned reason code 9 (Menu_Selection) and q%
  271. points to the corresponding block. You can use MenuUtil_Decode to call the
  272. item handler in the following way:
  273.  SYS "MenuUtil_Decode",,q% TO handler%                            
  274.  IF handler% THEN
  275.    handler$="FN"+$handler%
  276.    IF EVAL(handler$)
  277.  ENDIF
  278.                 
  279.  
  280.  
  281.  
  282.  
  283.  MenuUtil_Show (SWI &45BC5)
  284.  --------------------------
  285.  Displays menu on screen
  286.  
  287.  Entry:
  288.      R0 = handle of the menu or zero for current menu
  289.      R1 -> pointer to block or zero
  290.  Exit:
  291.      R0,R1 preserved
  292.  
  293. This call may be used to display menu on screen. Screen position for menu
  294. will be calculated according to rules described in PRM. Block pointed to by
  295. R1 must contain the same information as returned by Wimp_Poll in case of
  296. mouse click event (in fact only mouse coordinates and window handle will be
  297. used) :
  298.                      R1 + 0  mouse X
  299.                      R1 + 4  mouse Y
  300.                      R1 + 8  buttons
  301.                      R1 +12  window handle (-2 if icon bar)
  302.                      R1 +16  icon handle                
  303.  
  304. MenuUtils automatically distinguishes iconbar menus from ordinary
  305. window menus. If menu is already on screen and you want to reopen it
  306. after user selection with Adjust button then pointer to the block may be
  307. omitted.
  308.  
  309.  Example code:
  310.  Suppose Wimp_Poll has returned reason code 6 (Mouse_Click) and q% points to
  311. the returned block. Display menu on screen if the click is with Menu button.
  312.  buttons%=q%!8
  313.  IF (buttons% AND2)<>0 THEN SYS "MenuUtil_Show",mainMenu%,q%
  314.   
  315.  Leave menu on screen after selection with Adjust button
  316.  SYS "MenuUtil_Show"
  317.  
  318.  
  319.  
  320.  
  321.  MenuUtil_ShowSubMenu (SWI &45BC6)
  322.  ---------------------------------
  323.  Display submenu after receiving Message_MenuWarning
  324.  
  325.  Entry:
  326.      R0 = handle of the submenu or zero for current menu
  327.      R1 -> pointer to block
  328.  Exit:
  329.      R0,R1 preserved
  330.  
  331. This call may be used to display submenu when a message type MenuWarning
  332. (&400C0) is received by an application. This message is sent by the Wimp
  333. when submenu is about to be accessed by the pointer moving over the
  334. right-pointing arrow of the parent menu. (To find out the handle of the
  335. menu item in parent menu you can use MenuUtil_Decode).
  336.  
  337. R1 on entry must point to message block (in fact only two words at offsets
  338. +24 and +28 will be used).
  339.                  
  340. Note: If you plan to use MenuUtil_Decode then all submenu pointers must be
  341. valid. It means that you have to link submenu pointed to by R0 with
  342. corresponding menu item. This can be done by MenuUtil_SubMenu.
  343.  
  344.  Example code:
  345.  Display fonts submenu on screen after receiving MenuWarning:
  346.  SYS "MenuUtil_SubMenu",fontsItem%,fontsMenu%
  347.  SYS "MenuUtil_ShowSubMenu",fontsMenu%,q%
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  MenuUtil_Info (SWI &45BC7)
  354.  --------------------------
  355. This call returns various information about the whole menu or about the
  356. particular menu item.
  357.  
  358.  Entry:
  359.      R0 = handle of the menu or of the menu item or zero for current item
  360.  Exit:
  361.      R0 -> pointer to block
  362.  
  363. Returned block contains the following information:
  364.    R0 + 0 pointer to menu data structure
  365.    R0 + 4 pointer to item data or zero
  366.  
  367. Menus created with MenuUtils are not static and may be moved in
  368. memory, for example after adding new items. So you must use direct
  369. pointers to this menus with caution until you have completely finished
  370. the menu construction.
  371.  
  372.  
  373.  
  374.  
  375.  MenuUtil_Text (SWI &45BC8)
  376.  --------------------------
  377.  Changes menu title string or text of menu item
  378.  
  379.  Entry:
  380.      R0 = handle of menu item or handle of menu or  zero for current item
  381.      R1 -> pointer to text string 
  382.  Exit:
  383.      R0,R1 preserved
  384.  
  385. This call allows you to change title string of menu or text of menu item.
  386. The structure of menu tree remains unchanged but pointer to item text may be
  387. changed. The handle of the menu or menu item must be specified in R0. If R0
  388. is zero on entry then the text of current item will be changed. R1 must
  389. point to the ctrl-terminated text string. If R1 is zero on entry then null
  390. string will be used. Remember that the length of menu title is limited by 12
  391. symbols.
  392.  
  393.  Example code 
  394.  Set new menu title string:
  395.  SYS "MenuUtil_Text",objectMenu%,"Directory"
  396.  
  397.  Let's variable type% contains one of the values 0,1,2 or 3 depending on the
  398. object selected in Filer window and variable name$ contains the name of the
  399. file or directory selected.  
  400.  
  401. CASE type% OF
  402.   WHEN 0:i$="File ''"
  403.   WHEN 1:i$="File '"+name$+"'":s$="File"
  404.   WHEN 2:i$="Dir. '"+name$+"'":s$="Directory"
  405.   WHEN 3:i$="Selection":s$=i$
  406. ENDCASE
  407.                    
  408. REM fade the item if nothing is selected
  409. SYS "MenuUtil_Fade",objectItem%,type%=0           
  410.  
  411. REM set new item text
  412. SYS "MenuUtil_Text",,i$
  413.            
  414. REM set new submenu title
  415. SYS "MenuUtil_Text",toolsMenu%,s$
  416.  
  417.  
  418.  
  419.  
  420.  MenuUtil_Tick (SWI &45BC9)
  421.  --------------------------            
  422. This call may be used to modify the state of menu flag which controls
  423. the tick displayed on the left of the menu item. 
  424.  
  425.  Entry:
  426.      R0 handle of menu item or zero for current menu item or handle of menu
  427.      R1 defines action
  428.         if R1 =0 then clear tick flag 
  429.         if R1 <>0 then set tick flag  
  430.  Exit:
  431.     R0,R1 preserved
  432.             
  433. R0 must contain the item handle or zero for the current menu item. R1
  434. defines to set or to clear the flag. If R1 is zero then the flag will
  435. be cleared and if R1 is non zero then the flag will be set.
  436.  
  437. If R0 instead of item handle contains menu handle then the state of
  438. the flag will be changed in all items of this menu.
  439.  
  440. It is convenient to pass in R1 the result of logical expression (to
  441. set flag if result is TRUE and to clear it if FALSE).
  442.  
  443.  Example code:
  444.  Tick one of the items depending on the value of variable disp%:
  445.  SYS "MenuUtil_Tick",largeItem%,(disp%=1)
  446.  SYS "MenuUtil_Tick",smallItem,(disp%=2)
  447.  SYS "MenuUtil_Tick",fullItem%,(disp%=3)
  448.                                            
  449.  
  450.  
  451.  
  452.  MenuUtil_Dots (SWI  &45BCA)
  453.  ---------------------------            
  454. This call may be used to modify the state of menu flag which controls
  455. the dotted line displayed bellow the menu item. 
  456.  
  457.  Entry:
  458.      R0 handle of menu item or zero for current menu item or handle of menu
  459.      R1 defines action
  460.         if R1 =0 then clear dots flag 
  461.         if R1 <>0 then set dots flag  
  462.  Exit:
  463.     R0,R1 preserved
  464.             
  465. R0 must contain the item handle or zero for the current menu item. R1
  466. defines to set or to clear the flag. If R1 is zero then the flag will
  467. be cleared and if R1 is non zero then the flag will be set.
  468.  
  469. If R0 instead of item handle contains menu handle then the state of
  470. the flag will be changed in all items of this menu.
  471.  
  472. It is convenient to pass in R1 the result of logical expression (to
  473. set flag if result is TRUE and to clear it if FALSE).
  474.  
  475.  Example code:
  476.  Display dotted line after the current menu item
  477.  SYS "MenuUtil_Dots",,TRUE
  478.  
  479.                                            
  480.  
  481.  MenuUtil_Fade (&45BCB)
  482.  ----------------------            
  483. This call can be used to make menu item non-pickable 
  484.  
  485.  Entry:
  486.      R0 handle of menu item or zero for current menu item or handle of menu
  487.      R1 defines action
  488.         if R1 =0 clear shaded menu flag
  489.         if R1 <>0 fade this menu item (ie. unpickable) 
  490.  Exit:
  491.     R0,R1 preserved
  492.             
  493. R0 must contain the item handle or zero for the current menu item. R1
  494. defines to set or to clear the flag which makes menu item unpickable. If R1
  495. is zero then the flag will be cleared and if R1 is non zero then the flag
  496. will be set and the item will be shaded.
  497.  
  498. If R0 instead of item handle contains menu handle then the state of
  499. the flag will be changed in all items of this menu.
  500.  
  501. It is convenient to pass in R1 the result of logical expression (to
  502. set flag if result is TRUE and to clear it if FALSE).
  503.  
  504.  Example code:
  505.  Fade current menu item:
  506.  SYS "MenuUtil_Fade",,TRUE
  507.  
  508.  Fade all items in "Select" submenu with handle selctMenu%
  509.  SYS "MenuUtil_Fade",selectMenu%,TRUE
  510.  
  511.  
  512.  
  513.  
  514.  MenuUtil_Warning (SWI &45BCC)
  515.  -----------------------------            
  516. This call can be used to make menu item generate a message when moving to
  517. the submenu 
  518.  
  519.  Entry:
  520.      R0 handle of menu item or zero for current menu item or handle of menu
  521.      R1 defines action
  522.         if R1 =0 clear message menu flag
  523.         if R1 <>0 set message flag (ie. message will be generated) 
  524.  Exit:
  525.     R0,R1 preserved
  526.             
  527. R0 must contain the item handle or zero for the current menu item. R1
  528. defines to set or to clear the flag which changes submenu behaviour. If R1
  529. is not zero, then moving over the right arrow will cause a MenuWarning
  530. message (&400C0) to be generated. The application can respond by calling
  531. MenuUtil_ShowSubMenu to display appropriate object.
  532.  
  533. If R0 instead of item handle contains menu handle then the state of
  534. the flag will be changed in all items of this menu.
  535.  
  536. It is convenient to pass in R1 the result of logical expression (to
  537. set flag if result is TRUE and to clear it if FALSE).
  538.  
  539.  Example code:
  540.  Generate message when moving to the fonts submenu:
  541.  SYS "MenuUtil_Warning",fontsItem%,TRUE
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  MenuUtil_Writable (SWI &45BCD)
  548.  ------------------------------
  549.  Makes menu item writable.
  550.  
  551.  Entry:
  552.      R0 = handle of menu item or zero for current item or handle of the menu
  553.      R1 <>0 and
  554.      R2 = buffer size
  555.      R3 -> pointer to validation string, or
  556.  
  557.      R1 =0 makes item not writable
  558. Exit:
  559.      R0-R3 preserved
  560.  
  561. If R1 is not zero on entry then this call will convert existing menu item
  562. into writable item. R0 must contain the handle of the menu item or zero for
  563. current item. If R0 contains handle of the menu then all the items in this
  564. menu will be converted. 
  565.  
  566. R2 on entry contains the length of the buffer for the input string.
  567. The value in R2 must be not less then the length of the current item
  568. text. In the latter case the buffer will remain unchanged.
  569.  
  570. If R3<>0 on entry then it points to the ctrl-terminated validation
  571. string. The module makes its own copy of the string. If R3=0 on entry
  572. then no validation string will be used.
  573.  
  574. If R1 is zero on entry then the item will be converted back into ordinary
  575. menu item. In this case contents of registers R2 and R3 will be ignored.
  576.  
  577.  Example code:
  578.  Make current item writable without validation string
  579.  SYS "MenuUtil_Writable",,TRUE
  580.  
  581.  Make menu item with handle widthItem% writable, with buffer size 40 and
  582. allow to enter to it only digits.
  583.  SYS "MenuUtil_Writable",widthItem%,TRUE,40,"A0-9"
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  MenuUtil_Submenu (SWI &45BCE)
  590.  -----------------------------
  591.  Links submenu to menu item
  592.  
  593.  Entry:
  594.      R0 handle of the menu item or zero if current menu item
  595.      R1 handle of submenu or pointer to submenu or window handle
  596.         if R1<&8000 then R1 is window handle
  597.         if R1>&8000 then R1 is pointer to menu 
  598.         if R1<0 then R1 is menu handle
  599.  
  600.  Exit:
  601.      R0,R1 preserved
  602.  
  603. This call is used for constructing multilevel menus. R0 on entry
  604. contains the handle of menu item. This item is linked with submenu or
  605. dialog box depending on contents of R1. To connect submenu R1 may
  606. contain menu handle (as returned by "MenuUtil_New") or absolute pointer to
  607. the menu data structure. To connect dialog box R1 must contain window
  608. handle of dialog box (as returned by "Wimp_CreateWindow").
  609.  
  610.  
  611.  Example code:
  612.                         
  613.  Connect "About this program" window to the item "Info"
  614.  SYS "Wimp_CreateWindow",,block% TO infoWindow%
  615.  SYS "MenuUtil_Submenu",infoItem%,infoWindow%
  616.  
  617.  Create "Display" item in filer menu  
  618.  SYS "MenuUtil_New",,"Filer"
  619.  SYS "MenuUtil_Add",,"Display"
  620.  SYS "MenuUtil_Submenu",,dispMenu%   
  621.  
  622.  
  623.  
  624.                                 
  625.  MenuUtil_ColourMenu (SWI &45BCF)
  626.  --------------------------------
  627.  Creates a wimp colour setting menu
  628.  Entry:
  629.      R1 -> menu title string
  630.      R2 -> menu handle
  631.  Exit:                 
  632.      R0 = handle of the menu
  633.      R1 preserved
  634.  
  635. This call creates standard WIMP colour setting menu. R1 on entry
  636. points to the title string for the menu. If R2<>0 then it points to
  637. the handler common for all 16 items. (See also "MenuUtil_Add" for more
  638. info about item handlers). Despite the fact that the same handler is
  639. invoked with all items it is still possible to distinguish user
  640. selection. MenuUtil_Decode returns not only pointer to the handler but
  641. also the number (position) of selected item in the menu. Actually this
  642. number is equal to the colour number.
  643.  
  644.  
  645.  Example code:
  646.  Create colour setting menu:
  647.  SYS "MenuUtil_ColourMenu",,"Colour" TO colourMenu%
  648.  
  649.  
  650.  
  651.  
  652.  MenuUtil_Colours (SWI &45BD0)
  653.  -----------------------------
  654.  Sets new foreground and background colours of menu item
  655.  
  656.  Entry:
  657.      R0 = handle of the menu item or zero for current item
  658.      R1 = foreground colour
  659.      R2 = background colour
  660.  Exit:
  661.      R0-R2 preserved
  662.  
  663. This call allows you to change colours of particular menu item. Colours must
  664. be selected from 16 Wimp colours.
  665.                                    
  666.  Example code:
  667.  Change colours of current item to black on yellow
  668.  SYS "MenuUtil_Colours",,7,9
  669.  
  670.            
  671.  
  672.  
  673.  MenuUtil_TickOnly (SWI &45BD1)
  674.  ------------------------------
  675.  Tick only specified menu item
  676.  
  677.  Entry:
  678.      R0 = handle of the menu item or zero for current item, or
  679.           
  680.      R0 = handle of the menu
  681.      R1 = item position in the menu (starting from zero)
  682.  Exit:
  683.      R0,R1 preserved
  684.  
  685. This call ticks specified item and clears tick flags in remaining items in
  686. the menu. If you don't know the handle of the menu then you can specify
  687. handle of the menu in R0 and position of the item in R1.
  688.  
  689.  
  690.  Example code:
  691.  Tick black colour in colour menu
  692.  SYS "MenuUtil_TickOnly",colourMenu%,7
  693.  
  694.  
  695. ----------------------------------------------------------------------
  696.                      Notes from the author
  697.  
  698.  
  699. MenuUtils is freeware software. Everybody is free to use MenuUtils
  700. module, even in commercial code. In case of commercial use I would
  701. like to know this in advance (I could than provide you with the latest
  702. release). You can always contact me if you found some bug, or when
  703. having other suggestions.
  704.  
  705.          To contact the author of MenuUtils, please write to:
  706.                                       
  707.                                         RUSSIA
  708.                                         115541
  709.                                         Moscow
  710.                                         Kavkazsky boulevard, 29
  711.                                         Bld. 1, Flat 107
  712.                                         Alex Petrov    
  713.  
  714.                          E-mail: APetrov@misis.msk.su  
  715.                                  APetrov@arm.msk.su
  716.  
  717.                          FIDO :  2:5020/104.13
  718.                                  
  719.                           phone: +7 095 322 2098
  720.                           fax  : +7 095 236 8350
  721.  
  722.