Home » Archimedes archive » Archimedes World » AW-1995-01-Disc2.adf » Disk2Jan95 » !AWJan95/Goodies/Event/Docs/MenuSWIs

!AWJan95/Goodies/Event/Docs/MenuSWIs

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1995-01-Disc2.adf » Disk2Jan95
Filename: !AWJan95/Goodies/Event/Docs/MenuSWIs
Read OK:
File size: 62AB bytes
Load address: 0000
Exec address: 0000
File contents

             Documentation for the MenuUtils module v.0.10

                       � Petrov Software 1992

                                

                         Description of SWIs
 
SWI chunk prefix for the MenuUtils module is MenuUtil_ and base number
is &45BC0. My thanks to Acorn for the allocation of SWI chunk.

          Module MenuUtils provides the following SWIs:

                        "MenuUtil_Initialise"    
                        "MenuUtil_New"           
                        "MenuUtil_Add"           
                        "MenuUtil_Delete"  
                        "MenuUtil_Decode"
                        "MenuUtil_Show"    
                        "MenuUtil_ShowSubMenu" 
                        "MenuUtil_Info"    
                        "MenuUtil_Text"    
                        "MenuUtil_Tick"
                        "MenuUtil_Dots"    
                        "MenuUtil_Fade"    
                        "MenuUtil_Warning" 
                        "MenuUtil_Writable"
                        "MenuUtil_SubMenu" 
                        "MenuUtil_ColourMenu"  
                        "MenuUtil_Colours" 
                        "MenuUtil_TickOnly"

All calls to MenuUtils module (with the exception of
MenuUtil_Initialise and MenuUtil_New) expect in R0 the handle of the menu
or of the menu item. If the handle is omitted (R0=0) then the current menu
or current menu item is assumed (interpretation depends on particular SWI).  


 MenuUtil_Initialise (SWI &45BC0)
 --------------------------------
 To register the task as MenuUtils client
 
 Entry:
     R0 last MenuUtils version number known to task * 100                
     R1 initialisation type (see later)
        bit 0
            0 - "BASIC"
            1 - "machine code" (not supported by current version)
 Exit:
     R0 version number * 100
     R1,R2 preserved     

MenuUtil_Initialise should only be called once when the task starts up. It
must be called after Wimp_Initialise has been called and before any
other call to the MenuUtils module is made.

MenuUtils performs all the closedown work automatically when the
task finishes so no special MenuUtil_CloseDown SWI is provided.

 Example code:
 Register the task with any version of the module
 SYS "MenuUtil_Initialise"



 MenuUtil_New (SWI &45BC1)
 -------------------------
 Creates new empty menu.

 Entry:
     R1 pointer to menu title string
     R2 approximate number of items (default 5)

 Exit:
     R0 handle of created menu
    
This call creates new empty menu with specified title string. Colours
and dimensions of the menu are in standard RISC OS style. You can
specify number of items you are going to have in this menu. This is
optional but it can speed up the process of menu creation. It
may be important for big menus (for example for oldstyle fonts menu).

As Window Manager doesn't allow you to have menus absolutely without
menu items so each new menu is created together with one special item.
This item is created with the only aim to prevent crashes in case you
will accidentially try to open unfinished menu. The special item will
be removed automatically just after you add your first item to this
menu.

If your program has complex menu structure with submenus then you can
use this call to create not only main menu but also all submenus. And
you have to remember the handles of all submenus in order to link them
later to corresponding menu items in parent menu. If on the other hand
your program have only one menu without submenus then you may ignore
the returned menu handle because it will be anyway used as default in
all future calls to MenuUtils.

After this call the new menu becomes the current menu.

 Example code:
 Start construction of simple menu like one in Palette Utility
 SYS "MenuUtil_New",,"Palette" 
 
 If you program has complex menu structure (like Source Editor) then you
have to remember the handles of all submenus
 SYS "MenuUtil_New",,"SrcEdit" TO mainMenu%
 SYS "MenuUtil_New",,"Display" TO dispMenu%
 SYS "MenuUtil_New",,"Fonts",200  TO fontsMenu%

           


 MenuUtil_Add (SWI &45BC2)
 -------------------------
 Adds new item to existing menu.

 Entry:
     R0 handle of the menu or of the menu item or zero for current menu
     R1 pointer to item text
     R2 pointer to item handler

 Exit:
     R0 handle of menu item
     R1,R2 preserved


This call adds one item to the existing menu. If handle is the handle
of menu then new item will be added to the end of this menu. If handle
is the handle of the item then new item will be inserted into menu
just before this item. If R0 is zero on entry then item will be added
to the end of current menu.

During this call the current menu may be moved in memory so if you
keep direct pointers to the menu data structure they may become
invalid. On the other hand if there are any menu items linked with
this menu by means of MenuUtil_Submenu then all pointers will be
recalculated automatically by the module and will remain valid.

MenuUtils makes his own copy of the string pointed to by R1 but
inspite of this you still can easily change it with MenuUtil_Text. If R1
is zero on entry then null string ("") will be used as item text.

If R2 is not zero on entry then interpretation of it contents depends
on the initialisation type specified early during the call to
MenuUtil_Initialise. If initialisation type was specified as "BASIC" then
it is assumed that R2 is a pointer to the ctrl-terminated text string.
In this case the module makes his own copy of the string for later use
in MenuUtil_Decode. If initialisation type was "machine code" (not
supported by current version) then only the contents of R2 is saved by
the module. This feature allows you to attach a handler to the menu
item. In case of "BASIC" you can provide the name of BASIC function.
In case of "machine code" - the address of ARM subroutine. See also
MenuUtil_Decode and for possible use of item handlers.
               

 Example code:                              

 Add item "Info" to the current menu
 SYS "MenuUtil_Add",,"Info" TO infoItem%    

 Add item "Quit" and then insert item "Create" just before it.  Let's
the first item will have the handler. The handler is assumed to be
BASIC function FNquit. (See MenuUtil_Decode on how this handler may be
called) 
 SYS "MenuUtil_Add",,"Quit","quit" TO quitItem%
 SYS "MenuUtil_Add",quitItem%,"Create" TO createItem%                                  
 Create menu similar to Display submenu in Filer. When items are added
to current menu menu handle (dispMenu%) may be omitted as it will be
used by default.
 SYS "MenuUtil_New",,"Display" TO dispMenu%
 SYS "MenuUtil_Add",,"Large icons" TO largeItem%
 SYS "MenuUtil_Add",,"Small icons" TO smallItem%
 SYS "MenuUtil_Add",,"Full info" TO fullItem%

          


 MenuUtil_Delete (SWI &45BC3)
 ----------------------------
 Removes menu or menu item

 Entry:
     R0 = handle of the menu or of the menu item or zero for current menu
     if R1<>0 then recursively delete all submenus 
 Exit:
     R0,R1 preserved

This call allows you to delete the whole menu or the particular menu item.
If you will delete menu item then remained items of this menu which are
positioned bellow it will be automatically shifted in memory to fill the
hole. Despite the fact that memory location and position in menu of some
items may be changed the handles of the items will remain valid.

If you want to delete not only the item but also the whole menu subtree
connected with it then you must set R1<>0 on entry. If R0 contains the
handle of menu then this menu will be deleted alone or together with all
submenus depending on R1. 

Use recursive deletion with caution as you may accidentally delete
submenus which are connected with other menu items.

This call is supposed to be used when menus with variable number of items
are needed. It may be for example menu with the list of currently opened
documents or archives.

 Example code:
 Delete item with handle tmpItem%
 SYS "MenuUtil_Delete",tmpItem%

 Recursively delete all menus linked with mainMenu%
 SYS "MenuUtil_Delete",mainMenu%,TRUE
     
                                       




 MenuUtil_Decode (SWI &45BC4)
 ----------------------------
 Decodes menu after user selection.

 Entry:

     R0 = menu handle or zero if current menu
     R1 -> pointer to the list of menu selections
 Exit:
     R0 -> pointer to item handler or zero
     R1 -> TRUE if selection was made with ADJUST. (undocumented, but
           used in !TemplEd) 
     R2 -> pointer to block (original docs said this was returned in R1 -
           this appears to be incorrect!)

Block pointed to by R1 must contain the list of menu selections in the same
format as returned by Wimp_Poll in case of menu selection event. 

               R1 + 0  item in main menu which was selected (starting from 0)
               R1 + 4  item in first submenu which was selected
               R1 + 8  item in second submenu which was selected
                       ...
                       terminated by -1

This call maps the list of menu selections onto menu data structure and
determines corresponding menu items. Various information about last two
items from this list (selected item and parent item from menu one level up
if any) is written into special block. Pointer to this block is returned in
R1. Format of the returned block is as follows: 

 R1+0  position of selected menu item in menu (starting from 0)
 R1+4  pointer to selected item data
 R1+8  selected item handle or zero if item was created without MenuUtils
 R1+12 pointer to text string of selected item
 R1+16 position of parent menu item in menu (starting from 0)
 R1+20 pointer to parent item data
 R1+24 parent item handle or zero if item was created without MenuUtils
 R1+28 pointer to text string of parent item                         

If the item has been selected from the top-level menu then there will be no
parent item and corresponding part of the block will be filled with zeros.                                                                                     
If during creation of this item you have specified the handler then R0 on
exit will contain the pointer to this handler otherwise R0 will be zero.
Interpretation of item handler is determent by initialisation type (see
MenuUtil_Initialise). If initialisation type was "BASIC" then R0 will point to
ctrl-terminated text string. If initialisation type was "machine code" (not
supported by current version) then R0 will contain the value passed in R2 to
MenuUtil_Add. To invoke BASIC handler you can use EVAL statement.

Example code:
 Suppose Wimp_Poll has returned reason code 9 (Menu_Selection) and q%
points to the corresponding block. You can use MenuUtil_Decode to call the
item handler in the following way:
 SYS "MenuUtil_Decode",,q% TO handler%                            
 IF handler% THEN
   handler$="FN"+$handler%
   IF EVAL(handler$)
 ENDIF
                




 MenuUtil_Show (SWI &45BC5)
 --------------------------
 Displays menu on screen

 Entry:
     R0 = handle of the menu or zero for current menu
     R1 -> pointer to block or zero
 Exit:
     R0,R1 preserved

This call may be used to display menu on screen. Screen position for menu
will be calculated according to rules described in PRM. Block pointed to by
R1 must contain the same information as returned by Wimp_Poll in case of
mouse click event (in fact only mouse coordinates and window handle will be
used) :
                     R1 + 0  mouse X
                     R1 + 4  mouse Y
                     R1 + 8  buttons
                     R1 +12  window handle (-2 if icon bar)
                     R1 +16  icon handle                

MenuUtils automatically distinguishes iconbar menus from ordinary
window menus. If menu is already on screen and you want to reopen it
after user selection with Adjust button then pointer to the block may be
omitted.

 Example code:
 Suppose Wimp_Poll has returned reason code 6 (Mouse_Click) and q% points to
the returned block. Display menu on screen if the click is with Menu button.
 buttons%=q%!8
 IF (buttons% AND2)<>0 THEN SYS "MenuUtil_Show",mainMenu%,q%
  
 Leave menu on screen after selection with Adjust button
 SYS "MenuUtil_Show"




 MenuUtil_ShowSubMenu (SWI &45BC6)
 ---------------------------------
 Display submenu after receiving Message_MenuWarning
 
 Entry:
     R0 = handle of the submenu or zero for current menu
     R1 -> pointer to block
 Exit:
     R0,R1 preserved

This call may be used to display submenu when a message type MenuWarning
(&400C0) is received by an application. This message is sent by the Wimp
when submenu is about to be accessed by the pointer moving over the
right-pointing arrow of the parent menu. (To find out the handle of the
menu item in parent menu you can use MenuUtil_Decode).

R1 on entry must point to message block (in fact only two words at offsets
+24 and +28 will be used).
                 
Note: If you plan to use MenuUtil_Decode then all submenu pointers must be
valid. It means that you have to link submenu pointed to by R0 with
corresponding menu item. This can be done by MenuUtil_SubMenu.

 Example code:
 Display fonts submenu on screen after receiving MenuWarning:
 SYS "MenuUtil_SubMenu",fontsItem%,fontsMenu%
 SYS "MenuUtil_ShowSubMenu",fontsMenu%,q%
 




 MenuUtil_Info (SWI &45BC7)
 --------------------------
This call returns various information about the whole menu or about the
particular menu item.

 Entry:
     R0 = handle of the menu or of the menu item or zero for current item
 Exit:
     R0 -> pointer to block

Returned block contains the following information:
   R0 + 0 pointer to menu data structure
   R0 + 4 pointer to item data or zero

Menus created with MenuUtils are not static and may be moved in
memory, for example after adding new items. So you must use direct
pointers to this menus with caution until you have completely finished
the menu construction.




 MenuUtil_Text (SWI &45BC8)
 --------------------------
 Changes menu title string or text of menu item

 Entry:
     R0 = handle of menu item or handle of menu or  zero for current item
     R1 -> pointer to text string 
 Exit:
     R0,R1 preserved
 
This call allows you to change title string of menu or text of menu item.
The structure of menu tree remains unchanged but pointer to item text may be
changed. The handle of the menu or menu item must be specified in R0. If R0
is zero on entry then the text of current item will be changed. R1 must
point to the ctrl-terminated text string. If R1 is zero on entry then null
string will be used. Remember that the length of menu title is limited by 12
symbols.

 Example code 
 Set new menu title string:
 SYS "MenuUtil_Text",objectMenu%,"Directory"

 Let's variable type% contains one of the values 0,1,2 or 3 depending on the
object selected in Filer window and variable name$ contains the name of the
file or directory selected.  

CASE type% OF
  WHEN 0:i$="File ''"
  WHEN 1:i$="File '"+name$+"'":s$="File"
  WHEN 2:i$="Dir. '"+name$+"'":s$="Directory"
  WHEN 3:i$="Selection":s$=i$
ENDCASE
                   
REM fade the item if nothing is selected
SYS "MenuUtil_Fade",objectItem%,type%=0           

REM set new item text
SYS "MenuUtil_Text",,i$
           
REM set new submenu title
SYS "MenuUtil_Text",toolsMenu%,s$




 MenuUtil_Tick (SWI &45BC9)
 --------------------------            
This call may be used to modify the state of menu flag which controls
the tick displayed on the left of the menu item. 

 Entry:
     R0 handle of menu item or zero for current menu item or handle of menu
     R1 defines action
        if R1 =0 then clear tick flag 
        if R1 <>0 then set tick flag  
 Exit:
    R0,R1 preserved
            
R0 must contain the item handle or zero for the current menu item. R1
defines to set or to clear the flag. If R1 is zero then the flag will
be cleared and if R1 is non zero then the flag will be set.

If R0 instead of item handle contains menu handle then the state of
the flag will be changed in all items of this menu.

It is convenient to pass in R1 the result of logical expression (to
set flag if result is TRUE and to clear it if FALSE).

 Example code:
 Tick one of the items depending on the value of variable disp%:
 SYS "MenuUtil_Tick",largeItem%,(disp%=1)
 SYS "MenuUtil_Tick",smallItem,(disp%=2)
 SYS "MenuUtil_Tick",fullItem%,(disp%=3)
                                           



 MenuUtil_Dots (SWI  &45BCA)
 ---------------------------            
This call may be used to modify the state of menu flag which controls
the dotted line displayed bellow the menu item. 

 Entry:
     R0 handle of menu item or zero for current menu item or handle of menu
     R1 defines action
        if R1 =0 then clear dots flag 
        if R1 <>0 then set dots flag  
 Exit:
    R0,R1 preserved
            
R0 must contain the item handle or zero for the current menu item. R1
defines to set or to clear the flag. If R1 is zero then the flag will
be cleared and if R1 is non zero then the flag will be set.

If R0 instead of item handle contains menu handle then the state of
the flag will be changed in all items of this menu.

It is convenient to pass in R1 the result of logical expression (to
set flag if result is TRUE and to clear it if FALSE).

 Example code:
 Display dotted line after the current menu item
 SYS "MenuUtil_Dots",,TRUE
 
                                           

 MenuUtil_Fade (&45BCB)
 ----------------------            
This call can be used to make menu item non-pickable 

 Entry:
     R0 handle of menu item or zero for current menu item or handle of menu
     R1 defines action
        if R1 =0 clear shaded menu flag
        if R1 <>0 fade this menu item (ie. unpickable) 
 Exit:
    R0,R1 preserved
            
R0 must contain the item handle or zero for the current menu item. R1
defines to set or to clear the flag which makes menu item unpickable. If R1
is zero then the flag will be cleared and if R1 is non zero then the flag
will be set and the item will be shaded.

If R0 instead of item handle contains menu handle then the state of
the flag will be changed in all items of this menu.

It is convenient to pass in R1 the result of logical expression (to
set flag if result is TRUE and to clear it if FALSE).

 Example code:
 Fade current menu item:
 SYS "MenuUtil_Fade",,TRUE
 
 Fade all items in "Select" submenu with handle selctMenu%
 SYS "MenuUtil_Fade",selectMenu%,TRUE




 MenuUtil_Warning (SWI &45BCC)
 -----------------------------            
This call can be used to make menu item generate a message when moving to
the submenu 

 Entry:
     R0 handle of menu item or zero for current menu item or handle of menu
     R1 defines action
        if R1 =0 clear message menu flag
        if R1 <>0 set message flag (ie. message will be generated) 
 Exit:
    R0,R1 preserved
            
R0 must contain the item handle or zero for the current menu item. R1
defines to set or to clear the flag which changes submenu behaviour. If R1
is not zero, then moving over the right arrow will cause a MenuWarning
message (&400C0) to be generated. The application can respond by calling
MenuUtil_ShowSubMenu to display appropriate object.

If R0 instead of item handle contains menu handle then the state of
the flag will be changed in all items of this menu.

It is convenient to pass in R1 the result of logical expression (to
set flag if result is TRUE and to clear it if FALSE).

 Example code:
 Generate message when moving to the fonts submenu:
 SYS "MenuUtil_Warning",fontsItem%,TRUE
 




 MenuUtil_Writable (SWI &45BCD)
 ------------------------------
 Makes menu item writable.

 Entry:
     R0 = handle of menu item or zero for current item or handle of the menu
     R1 <>0 and
     R2 = buffer size
     R3 -> pointer to validation string, or

     R1 =0 makes item not writable
Exit:
     R0-R3 preserved

If R1 is not zero on entry then this call will convert existing menu item
into writable item. R0 must contain the handle of the menu item or zero for
current item. If R0 contains handle of the menu then all the items in this
menu will be converted. 

R2 on entry contains the length of the buffer for the input string.
The value in R2 must be not less then the length of the current item
text. In the latter case the buffer will remain unchanged.

If R3<>0 on entry then it points to the ctrl-terminated validation
string. The module makes its own copy of the string. If R3=0 on entry
then no validation string will be used.

If R1 is zero on entry then the item will be converted back into ordinary
menu item. In this case contents of registers R2 and R3 will be ignored.

 Example code:
 Make current item writable without validation string
 SYS "MenuUtil_Writable",,TRUE

 Make menu item with handle widthItem% writable, with buffer size 40 and
allow to enter to it only digits.
 SYS "MenuUtil_Writable",widthItem%,TRUE,40,"A0-9"





 MenuUtil_Submenu (SWI &45BCE)
 -----------------------------
 Links submenu to menu item

 Entry:
     R0 handle of the menu item or zero if current menu item
     R1 handle of submenu or pointer to submenu or window handle
        if R1<&8000 then R1 is window handle
        if R1>&8000 then R1 is pointer to menu 
        if R1<0 then R1 is menu handle

 Exit:
     R0,R1 preserved

This call is used for constructing multilevel menus. R0 on entry
contains the handle of menu item. This item is linked with submenu or
dialog box depending on contents of R1. To connect submenu R1 may
contain menu handle (as returned by "MenuUtil_New") or absolute pointer to
the menu data structure. To connect dialog box R1 must contain window
handle of dialog box (as returned by "Wimp_CreateWindow").


 Example code:
                        
 Connect "About this program" window to the item "Info"
 SYS "Wimp_CreateWindow",,block% TO infoWindow%
 SYS "MenuUtil_Submenu",infoItem%,infoWindow%

 Create "Display" item in filer menu  
 SYS "MenuUtil_New",,"Filer"
 SYS "MenuUtil_Add",,"Display"
 SYS "MenuUtil_Submenu",,dispMenu%   
 


                                
 MenuUtil_ColourMenu (SWI &45BCF)
 --------------------------------
 Creates a wimp colour setting menu
 Entry:
     R1 -> menu title string
     R2 -> menu handle
 Exit:                 
     R0 = handle of the menu
     R1 preserved

This call creates standard WIMP colour setting menu. R1 on entry
points to the title string for the menu. If R2<>0 then it points to
the handler common for all 16 items. (See also "MenuUtil_Add" for more
info about item handlers). Despite the fact that the same handler is
invoked with all items it is still possible to distinguish user
selection. MenuUtil_Decode returns not only pointer to the handler but
also the number (position) of selected item in the menu. Actually this
number is equal to the colour number.


 Example code:
 Create colour setting menu:
 SYS "MenuUtil_ColourMenu",,"Colour" TO colourMenu%




 MenuUtil_Colours (SWI &45BD0)
 -----------------------------
 Sets new foreground and background colours of menu item

 Entry:
     R0 = handle of the menu item or zero for current item
     R1 = foreground colour
     R2 = background colour
 Exit:
     R0-R2 preserved

This call allows you to change colours of particular menu item. Colours must
be selected from 16 Wimp colours.
                                   
 Example code:
 Change colours of current item to black on yellow
 SYS "MenuUtil_Colours",,7,9

           


 MenuUtil_TickOnly (SWI &45BD1)
 ------------------------------
 Tick only specified menu item

 Entry:
     R0 = handle of the menu item or zero for current item, or
          
     R0 = handle of the menu
     R1 = item position in the menu (starting from zero)
 Exit:
     R0,R1 preserved

This call ticks specified item and clears tick flags in remaining items in
the menu. If you don't know the handle of the menu then you can specify
handle of the menu in R0 and position of the item in R1.


 Example code:
 Tick black colour in colour menu
 SYS "MenuUtil_TickOnly",colourMenu%,7


----------------------------------------------------------------------
                     Notes from the author


MenuUtils is freeware software. Everybody is free to use MenuUtils
module, even in commercial code. In case of commercial use I would
like to know this in advance (I could than provide you with the latest
release). You can always contact me if you found some bug, or when
having other suggestions.

         To contact the author of MenuUtils, please write to:
                                      
                                        RUSSIA
                                        115541
                                        Moscow
                                        Kavkazsky boulevard, 29
                                        Bld. 1, Flat 107
                                        Alex Petrov    

                         E-mail: APetrov@misis.msk.su  
                                 APetrov@arm.msk.su

                         FIDO :  2:5020/104.13
                                 
                          phone: +7 095 322 2098
                          fax  : +7 095 236 8350

00000000  0a 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 44  |..             D|
00000010  6f 63 75 6d 65 6e 74 61  74 69 6f 6e 20 66 6f 72  |ocumentation for|
00000020  20 74 68 65 20 4d 65 6e  75 55 74 69 6c 73 20 6d  | the MenuUtils m|
00000030  6f 64 75 6c 65 20 76 2e  30 2e 31 30 0a 0a 20 20  |odule v.0.10..  |
00000040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000050  20 20 20 20 20 a9 20 50  65 74 72 6f 76 20 53 6f  |     . Petrov So|
00000060  66 74 77 61 72 65 20 31  39 39 32 0a 0a 20 20 20  |ftware 1992..   |
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000080  20 20 20 20 20 20 20 20  20 20 20 20 20 0a 0a 20  |             .. |
00000090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000000a0  20 20 20 20 20 20 20 20  44 65 73 63 72 69 70 74  |        Descript|
000000b0  69 6f 6e 20 6f 66 20 53  57 49 73 0a 20 0a 53 57  |ion of SWIs. .SW|
000000c0  49 20 63 68 75 6e 6b 20  70 72 65 66 69 78 20 66  |I chunk prefix f|
000000d0  6f 72 20 74 68 65 20 4d  65 6e 75 55 74 69 6c 73  |or the MenuUtils|
000000e0  20 6d 6f 64 75 6c 65 20  69 73 20 4d 65 6e 75 55  | module is MenuU|
000000f0  74 69 6c 5f 20 61 6e 64  20 62 61 73 65 20 6e 75  |til_ and base nu|
00000100  6d 62 65 72 0a 69 73 20  26 34 35 42 43 30 2e 20  |mber.is &45BC0. |
00000110  4d 79 20 74 68 61 6e 6b  73 20 74 6f 20 41 63 6f  |My thanks to Aco|
00000120  72 6e 20 66 6f 72 20 74  68 65 20 61 6c 6c 6f 63  |rn for the alloc|
00000130  61 74 69 6f 6e 20 6f 66  20 53 57 49 20 63 68 75  |ation of SWI chu|
00000140  6e 6b 2e 0a 0a 20 20 20  20 20 20 20 20 20 20 4d  |nk...          M|
00000150  6f 64 75 6c 65 20 4d 65  6e 75 55 74 69 6c 73 20  |odule MenuUtils |
00000160  70 72 6f 76 69 64 65 73  20 74 68 65 20 66 6f 6c  |provides the fol|
00000170  6c 6f 77 69 6e 67 20 53  57 49 73 3a 0a 0a 20 20  |lowing SWIs:..  |
00000180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000190  20 20 20 20 20 20 22 4d  65 6e 75 55 74 69 6c 5f  |      "MenuUtil_|
000001a0  49 6e 69 74 69 61 6c 69  73 65 22 20 20 20 20 0a  |Initialise"    .|
000001b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000001c0  20 20 20 20 20 20 20 20  22 4d 65 6e 75 55 74 69  |        "MenuUti|
000001d0  6c 5f 4e 65 77 22 20 20  20 20 20 20 20 20 20 20  |l_New"          |
000001e0  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
000001f0  20 20 20 20 20 20 20 20  20 20 22 4d 65 6e 75 55  |          "MenuU|
00000200  74 69 6c 5f 41 64 64 22  20 20 20 20 20 20 20 20  |til_Add"        |
00000210  20 20 20 0a 20 20 20 20  20 20 20 20 20 20 20 20  |   .            |
00000220  20 20 20 20 20 20 20 20  20 20 20 20 22 4d 65 6e  |            "Men|
00000230  75 55 74 69 6c 5f 44 65  6c 65 74 65 22 20 20 0a  |uUtil_Delete"  .|
00000240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000250  20 20 20 20 20 20 20 20  22 4d 65 6e 75 55 74 69  |        "MenuUti|
00000260  6c 5f 44 65 63 6f 64 65  22 0a 20 20 20 20 20 20  |l_Decode".      |
00000270  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000280  20 20 22 4d 65 6e 75 55  74 69 6c 5f 53 68 6f 77  |  "MenuUtil_Show|
00000290  22 20 20 20 20 0a 20 20  20 20 20 20 20 20 20 20  |"    .          |
000002a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 4d  |              "M|
000002b0  65 6e 75 55 74 69 6c 5f  53 68 6f 77 53 75 62 4d  |enuUtil_ShowSubM|
000002c0  65 6e 75 22 20 0a 20 20  20 20 20 20 20 20 20 20  |enu" .          |
000002d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 4d  |              "M|
000002e0  65 6e 75 55 74 69 6c 5f  49 6e 66 6f 22 20 20 20  |enuUtil_Info"   |
000002f0  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
00000300  20 20 20 20 20 20 20 20  20 20 22 4d 65 6e 75 55  |          "MenuU|
00000310  74 69 6c 5f 54 65 78 74  22 20 20 20 20 0a 20 20  |til_Text"    .  |
00000320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000330  20 20 20 20 20 20 22 4d  65 6e 75 55 74 69 6c 5f  |      "MenuUtil_|
00000340  54 69 63 6b 22 0a 20 20  20 20 20 20 20 20 20 20  |Tick".          |
00000350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 4d  |              "M|
00000360  65 6e 75 55 74 69 6c 5f  44 6f 74 73 22 20 20 20  |enuUtil_Dots"   |
00000370  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
00000380  20 20 20 20 20 20 20 20  20 20 22 4d 65 6e 75 55  |          "MenuU|
00000390  74 69 6c 5f 46 61 64 65  22 20 20 20 20 0a 20 20  |til_Fade"    .  |
000003a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003b0  20 20 20 20 20 20 22 4d  65 6e 75 55 74 69 6c 5f  |      "MenuUtil_|
000003c0  57 61 72 6e 69 6e 67 22  20 0a 20 20 20 20 20 20  |Warning" .      |
000003d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000003e0  20 20 22 4d 65 6e 75 55  74 69 6c 5f 57 72 69 74  |  "MenuUtil_Writ|
000003f0  61 62 6c 65 22 0a 20 20  20 20 20 20 20 20 20 20  |able".          |
00000400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 4d  |              "M|
00000410  65 6e 75 55 74 69 6c 5f  53 75 62 4d 65 6e 75 22  |enuUtil_SubMenu"|
00000420  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
00000430  20 20 20 20 20 20 20 20  20 20 22 4d 65 6e 75 55  |          "MenuU|
00000440  74 69 6c 5f 43 6f 6c 6f  75 72 4d 65 6e 75 22 20  |til_ColourMenu" |
00000450  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
00000460  20 20 20 20 20 20 20 20  20 20 22 4d 65 6e 75 55  |          "MenuU|
00000470  74 69 6c 5f 43 6f 6c 6f  75 72 73 22 20 0a 20 20  |til_Colours" .  |
00000480  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000490  20 20 20 20 20 20 22 4d  65 6e 75 55 74 69 6c 5f  |      "MenuUtil_|
000004a0  54 69 63 6b 4f 6e 6c 79  22 0a 0a 41 6c 6c 20 63  |TickOnly"..All c|
000004b0  61 6c 6c 73 20 74 6f 20  4d 65 6e 75 55 74 69 6c  |alls to MenuUtil|
000004c0  73 20 6d 6f 64 75 6c 65  20 28 77 69 74 68 20 74  |s module (with t|
000004d0  68 65 20 65 78 63 65 70  74 69 6f 6e 20 6f 66 0a  |he exception of.|
000004e0  4d 65 6e 75 55 74 69 6c  5f 49 6e 69 74 69 61 6c  |MenuUtil_Initial|
000004f0  69 73 65 20 61 6e 64 20  4d 65 6e 75 55 74 69 6c  |ise and MenuUtil|
00000500  5f 4e 65 77 29 20 65 78  70 65 63 74 20 69 6e 20  |_New) expect in |
00000510  52 30 20 74 68 65 20 68  61 6e 64 6c 65 20 6f 66  |R0 the handle of|
00000520  20 74 68 65 20 6d 65 6e  75 0a 6f 72 20 6f 66 20  | the menu.or of |
00000530  74 68 65 20 6d 65 6e 75  20 69 74 65 6d 2e 20 49  |the menu item. I|
00000540  66 20 74 68 65 20 68 61  6e 64 6c 65 20 69 73 20  |f the handle is |
00000550  6f 6d 69 74 74 65 64 20  28 52 30 3d 30 29 20 74  |omitted (R0=0) t|
00000560  68 65 6e 20 74 68 65 20  63 75 72 72 65 6e 74 20  |hen the current |
00000570  6d 65 6e 75 0a 6f 72 20  63 75 72 72 65 6e 74 20  |menu.or current |
00000580  6d 65 6e 75 20 69 74 65  6d 20 69 73 20 61 73 73  |menu item is ass|
00000590  75 6d 65 64 20 28 69 6e  74 65 72 70 72 65 74 61  |umed (interpreta|
000005a0  74 69 6f 6e 20 64 65 70  65 6e 64 73 20 6f 6e 20  |tion depends on |
000005b0  70 61 72 74 69 63 75 6c  61 72 20 53 57 49 29 2e  |particular SWI).|
000005c0  20 20 0a 0a 0a 20 4d 65  6e 75 55 74 69 6c 5f 49  |  ... MenuUtil_I|
000005d0  6e 69 74 69 61 6c 69 73  65 20 28 53 57 49 20 26  |nitialise (SWI &|
000005e0  34 35 42 43 30 29 0a 20  2d 2d 2d 2d 2d 2d 2d 2d  |45BC0). --------|
000005f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000600  2d 2d 2d 2d 2d 2d 2d 2d  0a 20 54 6f 20 72 65 67  |--------. To reg|
00000610  69 73 74 65 72 20 74 68  65 20 74 61 73 6b 20 61  |ister the task a|
00000620  73 20 4d 65 6e 75 55 74  69 6c 73 20 63 6c 69 65  |s MenuUtils clie|
00000630  6e 74 0a 20 0a 20 45 6e  74 72 79 3a 0a 20 20 20  |nt. . Entry:.   |
00000640  20 20 52 30 20 6c 61 73  74 20 4d 65 6e 75 55 74  |  R0 last MenuUt|
00000650  69 6c 73 20 76 65 72 73  69 6f 6e 20 6e 75 6d 62  |ils version numb|
00000660  65 72 20 6b 6e 6f 77 6e  20 74 6f 20 74 61 73 6b  |er known to task|
00000670  20 2a 20 31 30 30 20 20  20 20 20 20 20 20 20 20  | * 100          |
00000680  20 20 20 20 20 20 0a 20  20 20 20 20 52 31 20 69  |      .     R1 i|
00000690  6e 69 74 69 61 6c 69 73  61 74 69 6f 6e 20 74 79  |nitialisation ty|
000006a0  70 65 20 28 73 65 65 20  6c 61 74 65 72 29 0a 20  |pe (see later). |
000006b0  20 20 20 20 20 20 20 62  69 74 20 30 0a 20 20 20  |       bit 0.   |
000006c0  20 20 20 20 20 20 20 20  20 30 20 2d 20 22 42 41  |         0 - "BA|
000006d0  53 49 43 22 0a 20 20 20  20 20 20 20 20 20 20 20  |SIC".           |
000006e0  20 31 20 2d 20 22 6d 61  63 68 69 6e 65 20 63 6f  | 1 - "machine co|
000006f0  64 65 22 20 28 6e 6f 74  20 73 75 70 70 6f 72 74  |de" (not support|
00000700  65 64 20 62 79 20 63 75  72 72 65 6e 74 20 76 65  |ed by current ve|
00000710  72 73 69 6f 6e 29 0a 20  45 78 69 74 3a 0a 20 20  |rsion). Exit:.  |
00000720  20 20 20 52 30 20 76 65  72 73 69 6f 6e 20 6e 75  |   R0 version nu|
00000730  6d 62 65 72 20 2a 20 31  30 30 0a 20 20 20 20 20  |mber * 100.     |
00000740  52 31 2c 52 32 20 70 72  65 73 65 72 76 65 64 20  |R1,R2 preserved |
00000750  20 20 20 20 0a 0a 4d 65  6e 75 55 74 69 6c 5f 49  |    ..MenuUtil_I|
00000760  6e 69 74 69 61 6c 69 73  65 20 73 68 6f 75 6c 64  |nitialise should|
00000770  20 6f 6e 6c 79 20 62 65  20 63 61 6c 6c 65 64 20  | only be called |
00000780  6f 6e 63 65 20 77 68 65  6e 20 74 68 65 20 74 61  |once when the ta|
00000790  73 6b 20 73 74 61 72 74  73 20 75 70 2e 20 49 74  |sk starts up. It|
000007a0  0a 6d 75 73 74 20 62 65  20 63 61 6c 6c 65 64 20  |.must be called |
000007b0  61 66 74 65 72 20 57 69  6d 70 5f 49 6e 69 74 69  |after Wimp_Initi|
000007c0  61 6c 69 73 65 20 68 61  73 20 62 65 65 6e 20 63  |alise has been c|
000007d0  61 6c 6c 65 64 20 61 6e  64 20 62 65 66 6f 72 65  |alled and before|
000007e0  20 61 6e 79 0a 6f 74 68  65 72 20 63 61 6c 6c 20  | any.other call |
000007f0  74 6f 20 74 68 65 20 4d  65 6e 75 55 74 69 6c 73  |to the MenuUtils|
00000800  20 6d 6f 64 75 6c 65 20  69 73 20 6d 61 64 65 2e  | module is made.|
00000810  0a 0a 4d 65 6e 75 55 74  69 6c 73 20 70 65 72 66  |..MenuUtils perf|
00000820  6f 72 6d 73 20 61 6c 6c  20 74 68 65 20 63 6c 6f  |orms all the clo|
00000830  73 65 64 6f 77 6e 20 77  6f 72 6b 20 61 75 74 6f  |sedown work auto|
00000840  6d 61 74 69 63 61 6c 6c  79 20 77 68 65 6e 20 74  |matically when t|
00000850  68 65 0a 74 61 73 6b 20  66 69 6e 69 73 68 65 73  |he.task finishes|
00000860  20 73 6f 20 6e 6f 20 73  70 65 63 69 61 6c 20 4d  | so no special M|
00000870  65 6e 75 55 74 69 6c 5f  43 6c 6f 73 65 44 6f 77  |enuUtil_CloseDow|
00000880  6e 20 53 57 49 20 69 73  20 70 72 6f 76 69 64 65  |n SWI is provide|
00000890  64 2e 0a 0a 20 45 78 61  6d 70 6c 65 20 63 6f 64  |d... Example cod|
000008a0  65 3a 0a 20 52 65 67 69  73 74 65 72 20 74 68 65  |e:. Register the|
000008b0  20 74 61 73 6b 20 77 69  74 68 20 61 6e 79 20 76  | task with any v|
000008c0  65 72 73 69 6f 6e 20 6f  66 20 74 68 65 20 6d 6f  |ersion of the mo|
000008d0  64 75 6c 65 0a 20 53 59  53 20 22 4d 65 6e 75 55  |dule. SYS "MenuU|
000008e0  74 69 6c 5f 49 6e 69 74  69 61 6c 69 73 65 22 0a  |til_Initialise".|
000008f0  0a 0a 0a 20 4d 65 6e 75  55 74 69 6c 5f 4e 65 77  |... MenuUtil_New|
00000900  20 28 53 57 49 20 26 34  35 42 43 31 29 0a 20 2d  | (SWI &45BC1). -|
00000910  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000920  2d 2d 2d 2d 2d 2d 2d 2d  0a 20 43 72 65 61 74 65  |--------. Create|
00000930  73 20 6e 65 77 20 65 6d  70 74 79 20 6d 65 6e 75  |s new empty menu|
00000940  2e 0a 0a 20 45 6e 74 72  79 3a 0a 20 20 20 20 20  |... Entry:.     |
00000950  52 31 20 70 6f 69 6e 74  65 72 20 74 6f 20 6d 65  |R1 pointer to me|
00000960  6e 75 20 74 69 74 6c 65  20 73 74 72 69 6e 67 0a  |nu title string.|
00000970  20 20 20 20 20 52 32 20  61 70 70 72 6f 78 69 6d  |     R2 approxim|
00000980  61 74 65 20 6e 75 6d 62  65 72 20 6f 66 20 69 74  |ate number of it|
00000990  65 6d 73 20 28 64 65 66  61 75 6c 74 20 35 29 0a  |ems (default 5).|
000009a0  0a 20 45 78 69 74 3a 0a  20 20 20 20 20 52 30 20  |. Exit:.     R0 |
000009b0  68 61 6e 64 6c 65 20 6f  66 20 63 72 65 61 74 65  |handle of create|
000009c0  64 20 6d 65 6e 75 0a 20  20 20 20 0a 54 68 69 73  |d menu.    .This|
000009d0  20 63 61 6c 6c 20 63 72  65 61 74 65 73 20 6e 65  | call creates ne|
000009e0  77 20 65 6d 70 74 79 20  6d 65 6e 75 20 77 69 74  |w empty menu wit|
000009f0  68 20 73 70 65 63 69 66  69 65 64 20 74 69 74 6c  |h specified titl|
00000a00  65 20 73 74 72 69 6e 67  2e 20 43 6f 6c 6f 75 72  |e string. Colour|
00000a10  73 0a 61 6e 64 20 64 69  6d 65 6e 73 69 6f 6e 73  |s.and dimensions|
00000a20  20 6f 66 20 74 68 65 20  6d 65 6e 75 20 61 72 65  | of the menu are|
00000a30  20 69 6e 20 73 74 61 6e  64 61 72 64 20 52 49 53  | in standard RIS|
00000a40  43 20 4f 53 20 73 74 79  6c 65 2e 20 59 6f 75 20  |C OS style. You |
00000a50  63 61 6e 0a 73 70 65 63  69 66 79 20 6e 75 6d 62  |can.specify numb|
00000a60  65 72 20 6f 66 20 69 74  65 6d 73 20 79 6f 75 20  |er of items you |
00000a70  61 72 65 20 67 6f 69 6e  67 20 74 6f 20 68 61 76  |are going to hav|
00000a80  65 20 69 6e 20 74 68 69  73 20 6d 65 6e 75 2e 20  |e in this menu. |
00000a90  54 68 69 73 20 69 73 0a  6f 70 74 69 6f 6e 61 6c  |This is.optional|
00000aa0  20 62 75 74 20 69 74 20  63 61 6e 20 73 70 65 65  | but it can spee|
00000ab0  64 20 75 70 20 74 68 65  20 70 72 6f 63 65 73 73  |d up the process|
00000ac0  20 6f 66 20 6d 65 6e 75  20 63 72 65 61 74 69 6f  | of menu creatio|
00000ad0  6e 2e 20 49 74 0a 6d 61  79 20 62 65 20 69 6d 70  |n. It.may be imp|
00000ae0  6f 72 74 61 6e 74 20 66  6f 72 20 62 69 67 20 6d  |ortant for big m|
00000af0  65 6e 75 73 20 28 66 6f  72 20 65 78 61 6d 70 6c  |enus (for exampl|
00000b00  65 20 66 6f 72 20 6f 6c  64 73 74 79 6c 65 20 66  |e for oldstyle f|
00000b10  6f 6e 74 73 20 6d 65 6e  75 29 2e 0a 0a 41 73 20  |onts menu)...As |
00000b20  57 69 6e 64 6f 77 20 4d  61 6e 61 67 65 72 20 64  |Window Manager d|
00000b30  6f 65 73 6e 27 74 20 61  6c 6c 6f 77 20 79 6f 75  |oesn't allow you|
00000b40  20 74 6f 20 68 61 76 65  20 6d 65 6e 75 73 20 61  | to have menus a|
00000b50  62 73 6f 6c 75 74 65 6c  79 20 77 69 74 68 6f 75  |bsolutely withou|
00000b60  74 0a 6d 65 6e 75 20 69  74 65 6d 73 20 73 6f 20  |t.menu items so |
00000b70  65 61 63 68 20 6e 65 77  20 6d 65 6e 75 20 69 73  |each new menu is|
00000b80  20 63 72 65 61 74 65 64  20 74 6f 67 65 74 68 65  | created togethe|
00000b90  72 20 77 69 74 68 20 6f  6e 65 20 73 70 65 63 69  |r with one speci|
00000ba0  61 6c 20 69 74 65 6d 2e  0a 54 68 69 73 20 69 74  |al item..This it|
00000bb0  65 6d 20 69 73 20 63 72  65 61 74 65 64 20 77 69  |em is created wi|
00000bc0  74 68 20 74 68 65 20 6f  6e 6c 79 20 61 69 6d 20  |th the only aim |
00000bd0  74 6f 20 70 72 65 76 65  6e 74 20 63 72 61 73 68  |to prevent crash|
00000be0  65 73 20 69 6e 20 63 61  73 65 20 79 6f 75 0a 77  |es in case you.w|
00000bf0  69 6c 6c 20 61 63 63 69  64 65 6e 74 69 61 6c 6c  |ill accidentiall|
00000c00  79 20 74 72 79 20 74 6f  20 6f 70 65 6e 20 75 6e  |y try to open un|
00000c10  66 69 6e 69 73 68 65 64  20 6d 65 6e 75 2e 20 54  |finished menu. T|
00000c20  68 65 20 73 70 65 63 69  61 6c 20 69 74 65 6d 20  |he special item |
00000c30  77 69 6c 6c 0a 62 65 20  72 65 6d 6f 76 65 64 20  |will.be removed |
00000c40  61 75 74 6f 6d 61 74 69  63 61 6c 6c 79 20 6a 75  |automatically ju|
00000c50  73 74 20 61 66 74 65 72  20 79 6f 75 20 61 64 64  |st after you add|
00000c60  20 79 6f 75 72 20 66 69  72 73 74 20 69 74 65 6d  | your first item|
00000c70  20 74 6f 20 74 68 69 73  0a 6d 65 6e 75 2e 0a 0a  | to this.menu...|
00000c80  49 66 20 79 6f 75 72 20  70 72 6f 67 72 61 6d 20  |If your program |
00000c90  68 61 73 20 63 6f 6d 70  6c 65 78 20 6d 65 6e 75  |has complex menu|
00000ca0  20 73 74 72 75 63 74 75  72 65 20 77 69 74 68 20  | structure with |
00000cb0  73 75 62 6d 65 6e 75 73  20 74 68 65 6e 20 79 6f  |submenus then yo|
00000cc0  75 20 63 61 6e 0a 75 73  65 20 74 68 69 73 20 63  |u can.use this c|
00000cd0  61 6c 6c 20 74 6f 20 63  72 65 61 74 65 20 6e 6f  |all to create no|
00000ce0  74 20 6f 6e 6c 79 20 6d  61 69 6e 20 6d 65 6e 75  |t only main menu|
00000cf0  20 62 75 74 20 61 6c 73  6f 20 61 6c 6c 20 73 75  | but also all su|
00000d00  62 6d 65 6e 75 73 2e 20  41 6e 64 0a 79 6f 75 20  |bmenus. And.you |
00000d10  68 61 76 65 20 74 6f 20  72 65 6d 65 6d 62 65 72  |have to remember|
00000d20  20 74 68 65 20 68 61 6e  64 6c 65 73 20 6f 66 20  | the handles of |
00000d30  61 6c 6c 20 73 75 62 6d  65 6e 75 73 20 69 6e 20  |all submenus in |
00000d40  6f 72 64 65 72 20 74 6f  20 6c 69 6e 6b 20 74 68  |order to link th|
00000d50  65 6d 0a 6c 61 74 65 72  20 74 6f 20 63 6f 72 72  |em.later to corr|
00000d60  65 73 70 6f 6e 64 69 6e  67 20 6d 65 6e 75 20 69  |esponding menu i|
00000d70  74 65 6d 73 20 69 6e 20  70 61 72 65 6e 74 20 6d  |tems in parent m|
00000d80  65 6e 75 2e 20 49 66 20  6f 6e 20 74 68 65 20 6f  |enu. If on the o|
00000d90  74 68 65 72 20 68 61 6e  64 0a 79 6f 75 72 20 70  |ther hand.your p|
00000da0  72 6f 67 72 61 6d 20 68  61 76 65 20 6f 6e 6c 79  |rogram have only|
00000db0  20 6f 6e 65 20 6d 65 6e  75 20 77 69 74 68 6f 75  | one menu withou|
00000dc0  74 20 73 75 62 6d 65 6e  75 73 20 74 68 65 6e 20  |t submenus then |
00000dd0  79 6f 75 20 6d 61 79 20  69 67 6e 6f 72 65 0a 74  |you may ignore.t|
00000de0  68 65 20 72 65 74 75 72  6e 65 64 20 6d 65 6e 75  |he returned menu|
00000df0  20 68 61 6e 64 6c 65 20  62 65 63 61 75 73 65 20  | handle because |
00000e00  69 74 20 77 69 6c 6c 20  62 65 20 61 6e 79 77 61  |it will be anywa|
00000e10  79 20 75 73 65 64 20 61  73 20 64 65 66 61 75 6c  |y used as defaul|
00000e20  74 20 69 6e 0a 61 6c 6c  20 66 75 74 75 72 65 20  |t in.all future |
00000e30  63 61 6c 6c 73 20 74 6f  20 4d 65 6e 75 55 74 69  |calls to MenuUti|
00000e40  6c 73 2e 0a 0a 41 66 74  65 72 20 74 68 69 73 20  |ls...After this |
00000e50  63 61 6c 6c 20 74 68 65  20 6e 65 77 20 6d 65 6e  |call the new men|
00000e60  75 20 62 65 63 6f 6d 65  73 20 74 68 65 20 63 75  |u becomes the cu|
00000e70  72 72 65 6e 74 20 6d 65  6e 75 2e 0a 0a 20 45 78  |rrent menu... Ex|
00000e80  61 6d 70 6c 65 20 63 6f  64 65 3a 0a 20 53 74 61  |ample code:. Sta|
00000e90  72 74 20 63 6f 6e 73 74  72 75 63 74 69 6f 6e 20  |rt construction |
00000ea0  6f 66 20 73 69 6d 70 6c  65 20 6d 65 6e 75 20 6c  |of simple menu l|
00000eb0  69 6b 65 20 6f 6e 65 20  69 6e 20 50 61 6c 65 74  |ike one in Palet|
00000ec0  74 65 20 55 74 69 6c 69  74 79 0a 20 53 59 53 20  |te Utility. SYS |
00000ed0  22 4d 65 6e 75 55 74 69  6c 5f 4e 65 77 22 2c 2c  |"MenuUtil_New",,|
00000ee0  22 50 61 6c 65 74 74 65  22 20 0a 20 0a 20 49 66  |"Palette" . . If|
00000ef0  20 79 6f 75 20 70 72 6f  67 72 61 6d 20 68 61 73  | you program has|
00000f00  20 63 6f 6d 70 6c 65 78  20 6d 65 6e 75 20 73 74  | complex menu st|
00000f10  72 75 63 74 75 72 65 20  28 6c 69 6b 65 20 53 6f  |ructure (like So|
00000f20  75 72 63 65 20 45 64 69  74 6f 72 29 20 74 68 65  |urce Editor) the|
00000f30  6e 20 79 6f 75 0a 68 61  76 65 20 74 6f 20 72 65  |n you.have to re|
00000f40  6d 65 6d 62 65 72 20 74  68 65 20 68 61 6e 64 6c  |member the handl|
00000f50  65 73 20 6f 66 20 61 6c  6c 20 73 75 62 6d 65 6e  |es of all submen|
00000f60  75 73 0a 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |us. SYS "MenuUti|
00000f70  6c 5f 4e 65 77 22 2c 2c  22 53 72 63 45 64 69 74  |l_New",,"SrcEdit|
00000f80  22 20 54 4f 20 6d 61 69  6e 4d 65 6e 75 25 0a 20  |" TO mainMenu%. |
00000f90  53 59 53 20 22 4d 65 6e  75 55 74 69 6c 5f 4e 65  |SYS "MenuUtil_Ne|
00000fa0  77 22 2c 2c 22 44 69 73  70 6c 61 79 22 20 54 4f  |w",,"Display" TO|
00000fb0  20 64 69 73 70 4d 65 6e  75 25 0a 20 53 59 53 20  | dispMenu%. SYS |
00000fc0  22 4d 65 6e 75 55 74 69  6c 5f 4e 65 77 22 2c 2c  |"MenuUtil_New",,|
00000fd0  22 46 6f 6e 74 73 22 2c  32 30 30 20 20 54 4f 20  |"Fonts",200  TO |
00000fe0  66 6f 6e 74 73 4d 65 6e  75 25 0a 0a 20 20 20 20  |fontsMenu%..    |
00000ff0  20 20 20 20 20 20 20 0a  0a 0a 20 4d 65 6e 75 55  |       ... MenuU|
00001000  74 69 6c 5f 41 64 64 20  28 53 57 49 20 26 34 35  |til_Add (SWI &45|
00001010  42 43 32 29 0a 20 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |BC2). ----------|
00001020  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0a  |---------------.|
00001030  20 41 64 64 73 20 6e 65  77 20 69 74 65 6d 20 74  | Adds new item t|
00001040  6f 20 65 78 69 73 74 69  6e 67 20 6d 65 6e 75 2e  |o existing menu.|
00001050  0a 0a 20 45 6e 74 72 79  3a 0a 20 20 20 20 20 52  |.. Entry:.     R|
00001060  30 20 68 61 6e 64 6c 65  20 6f 66 20 74 68 65 20  |0 handle of the |
00001070  6d 65 6e 75 20 6f 72 20  6f 66 20 74 68 65 20 6d  |menu or of the m|
00001080  65 6e 75 20 69 74 65 6d  20 6f 72 20 7a 65 72 6f  |enu item or zero|
00001090  20 66 6f 72 20 63 75 72  72 65 6e 74 20 6d 65 6e  | for current men|
000010a0  75 0a 20 20 20 20 20 52  31 20 70 6f 69 6e 74 65  |u.     R1 pointe|
000010b0  72 20 74 6f 20 69 74 65  6d 20 74 65 78 74 0a 20  |r to item text. |
000010c0  20 20 20 20 52 32 20 70  6f 69 6e 74 65 72 20 74  |    R2 pointer t|
000010d0  6f 20 69 74 65 6d 20 68  61 6e 64 6c 65 72 0a 0a  |o item handler..|
000010e0  20 45 78 69 74 3a 0a 20  20 20 20 20 52 30 20 68  | Exit:.     R0 h|
000010f0  61 6e 64 6c 65 20 6f 66  20 6d 65 6e 75 20 69 74  |andle of menu it|
00001100  65 6d 0a 20 20 20 20 20  52 31 2c 52 32 20 70 72  |em.     R1,R2 pr|
00001110  65 73 65 72 76 65 64 0a  0a 0a 54 68 69 73 20 63  |eserved...This c|
00001120  61 6c 6c 20 61 64 64 73  20 6f 6e 65 20 69 74 65  |all adds one ite|
00001130  6d 20 74 6f 20 74 68 65  20 65 78 69 73 74 69 6e  |m to the existin|
00001140  67 20 6d 65 6e 75 2e 20  49 66 20 68 61 6e 64 6c  |g menu. If handl|
00001150  65 20 69 73 20 74 68 65  20 68 61 6e 64 6c 65 0a  |e is the handle.|
00001160  6f 66 20 6d 65 6e 75 20  74 68 65 6e 20 6e 65 77  |of menu then new|
00001170  20 69 74 65 6d 20 77 69  6c 6c 20 62 65 20 61 64  | item will be ad|
00001180  64 65 64 20 74 6f 20 74  68 65 20 65 6e 64 20 6f  |ded to the end o|
00001190  66 20 74 68 69 73 20 6d  65 6e 75 2e 20 49 66 20  |f this menu. If |
000011a0  68 61 6e 64 6c 65 0a 69  73 20 74 68 65 20 68 61  |handle.is the ha|
000011b0  6e 64 6c 65 20 6f 66 20  74 68 65 20 69 74 65 6d  |ndle of the item|
000011c0  20 74 68 65 6e 20 6e 65  77 20 69 74 65 6d 20 77  | then new item w|
000011d0  69 6c 6c 20 62 65 20 69  6e 73 65 72 74 65 64 20  |ill be inserted |
000011e0  69 6e 74 6f 20 6d 65 6e  75 0a 6a 75 73 74 20 62  |into menu.just b|
000011f0  65 66 6f 72 65 20 74 68  69 73 20 69 74 65 6d 2e  |efore this item.|
00001200  20 49 66 20 52 30 20 69  73 20 7a 65 72 6f 20 6f  | If R0 is zero o|
00001210  6e 20 65 6e 74 72 79 20  74 68 65 6e 20 69 74 65  |n entry then ite|
00001220  6d 20 77 69 6c 6c 20 62  65 20 61 64 64 65 64 0a  |m will be added.|
00001230  74 6f 20 74 68 65 20 65  6e 64 20 6f 66 20 63 75  |to the end of cu|
00001240  72 72 65 6e 74 20 6d 65  6e 75 2e 0a 0a 44 75 72  |rrent menu...Dur|
00001250  69 6e 67 20 74 68 69 73  20 63 61 6c 6c 20 74 68  |ing this call th|
00001260  65 20 63 75 72 72 65 6e  74 20 6d 65 6e 75 20 6d  |e current menu m|
00001270  61 79 20 62 65 20 6d 6f  76 65 64 20 69 6e 20 6d  |ay be moved in m|
00001280  65 6d 6f 72 79 20 73 6f  20 69 66 20 79 6f 75 0a  |emory so if you.|
00001290  6b 65 65 70 20 64 69 72  65 63 74 20 70 6f 69 6e  |keep direct poin|
000012a0  74 65 72 73 20 74 6f 20  74 68 65 20 6d 65 6e 75  |ters to the menu|
000012b0  20 64 61 74 61 20 73 74  72 75 63 74 75 72 65 20  | data structure |
000012c0  74 68 65 79 20 6d 61 79  20 62 65 63 6f 6d 65 0a  |they may become.|
000012d0  69 6e 76 61 6c 69 64 2e  20 4f 6e 20 74 68 65 20  |invalid. On the |
000012e0  6f 74 68 65 72 20 68 61  6e 64 20 69 66 20 74 68  |other hand if th|
000012f0  65 72 65 20 61 72 65 20  61 6e 79 20 6d 65 6e 75  |ere are any menu|
00001300  20 69 74 65 6d 73 20 6c  69 6e 6b 65 64 20 77 69  | items linked wi|
00001310  74 68 0a 74 68 69 73 20  6d 65 6e 75 20 62 79 20  |th.this menu by |
00001320  6d 65 61 6e 73 20 6f 66  20 4d 65 6e 75 55 74 69  |means of MenuUti|
00001330  6c 5f 53 75 62 6d 65 6e  75 20 74 68 65 6e 20 61  |l_Submenu then a|
00001340  6c 6c 20 70 6f 69 6e 74  65 72 73 20 77 69 6c 6c  |ll pointers will|
00001350  20 62 65 0a 72 65 63 61  6c 63 75 6c 61 74 65 64  | be.recalculated|
00001360  20 61 75 74 6f 6d 61 74  69 63 61 6c 6c 79 20 62  | automatically b|
00001370  79 20 74 68 65 20 6d 6f  64 75 6c 65 20 61 6e 64  |y the module and|
00001380  20 77 69 6c 6c 20 72 65  6d 61 69 6e 20 76 61 6c  | will remain val|
00001390  69 64 2e 0a 0a 4d 65 6e  75 55 74 69 6c 73 20 6d  |id...MenuUtils m|
000013a0  61 6b 65 73 20 68 69 73  20 6f 77 6e 20 63 6f 70  |akes his own cop|
000013b0  79 20 6f 66 20 74 68 65  20 73 74 72 69 6e 67 20  |y of the string |
000013c0  70 6f 69 6e 74 65 64 20  74 6f 20 62 79 20 52 31  |pointed to by R1|
000013d0  20 62 75 74 0a 69 6e 73  70 69 74 65 20 6f 66 20  | but.inspite of |
000013e0  74 68 69 73 20 79 6f 75  20 73 74 69 6c 6c 20 63  |this you still c|
000013f0  61 6e 20 65 61 73 69 6c  79 20 63 68 61 6e 67 65  |an easily change|
00001400  20 69 74 20 77 69 74 68  20 4d 65 6e 75 55 74 69  | it with MenuUti|
00001410  6c 5f 54 65 78 74 2e 20  49 66 20 52 31 0a 69 73  |l_Text. If R1.is|
00001420  20 7a 65 72 6f 20 6f 6e  20 65 6e 74 72 79 20 74  | zero on entry t|
00001430  68 65 6e 20 6e 75 6c 6c  20 73 74 72 69 6e 67 20  |hen null string |
00001440  28 22 22 29 20 77 69 6c  6c 20 62 65 20 75 73 65  |("") will be use|
00001450  64 20 61 73 20 69 74 65  6d 20 74 65 78 74 2e 0a  |d as item text..|
00001460  0a 49 66 20 52 32 20 69  73 20 6e 6f 74 20 7a 65  |.If R2 is not ze|
00001470  72 6f 20 6f 6e 20 65 6e  74 72 79 20 74 68 65 6e  |ro on entry then|
00001480  20 69 6e 74 65 72 70 72  65 74 61 74 69 6f 6e 20  | interpretation |
00001490  6f 66 20 69 74 20 63 6f  6e 74 65 6e 74 73 20 64  |of it contents d|
000014a0  65 70 65 6e 64 73 0a 6f  6e 20 74 68 65 20 69 6e  |epends.on the in|
000014b0  69 74 69 61 6c 69 73 61  74 69 6f 6e 20 74 79 70  |itialisation typ|
000014c0  65 20 73 70 65 63 69 66  69 65 64 20 65 61 72 6c  |e specified earl|
000014d0  79 20 64 75 72 69 6e 67  20 74 68 65 20 63 61 6c  |y during the cal|
000014e0  6c 20 74 6f 0a 4d 65 6e  75 55 74 69 6c 5f 49 6e  |l to.MenuUtil_In|
000014f0  69 74 69 61 6c 69 73 65  2e 20 49 66 20 69 6e 69  |itialise. If ini|
00001500  74 69 61 6c 69 73 61 74  69 6f 6e 20 74 79 70 65  |tialisation type|
00001510  20 77 61 73 20 73 70 65  63 69 66 69 65 64 20 61  | was specified a|
00001520  73 20 22 42 41 53 49 43  22 20 74 68 65 6e 0a 69  |s "BASIC" then.i|
00001530  74 20 69 73 20 61 73 73  75 6d 65 64 20 74 68 61  |t is assumed tha|
00001540  74 20 52 32 20 69 73 20  61 20 70 6f 69 6e 74 65  |t R2 is a pointe|
00001550  72 20 74 6f 20 74 68 65  20 63 74 72 6c 2d 74 65  |r to the ctrl-te|
00001560  72 6d 69 6e 61 74 65 64  20 74 65 78 74 20 73 74  |rminated text st|
00001570  72 69 6e 67 2e 0a 49 6e  20 74 68 69 73 20 63 61  |ring..In this ca|
00001580  73 65 20 74 68 65 20 6d  6f 64 75 6c 65 20 6d 61  |se the module ma|
00001590  6b 65 73 20 68 69 73 20  6f 77 6e 20 63 6f 70 79  |kes his own copy|
000015a0  20 6f 66 20 74 68 65 20  73 74 72 69 6e 67 20 66  | of the string f|
000015b0  6f 72 20 6c 61 74 65 72  20 75 73 65 0a 69 6e 20  |or later use.in |
000015c0  4d 65 6e 75 55 74 69 6c  5f 44 65 63 6f 64 65 2e  |MenuUtil_Decode.|
000015d0  20 49 66 20 69 6e 69 74  69 61 6c 69 73 61 74 69  | If initialisati|
000015e0  6f 6e 20 74 79 70 65 20  77 61 73 20 22 6d 61 63  |on type was "mac|
000015f0  68 69 6e 65 20 63 6f 64  65 22 20 28 6e 6f 74 0a  |hine code" (not.|
00001600  73 75 70 70 6f 72 74 65  64 20 62 79 20 63 75 72  |supported by cur|
00001610  72 65 6e 74 20 76 65 72  73 69 6f 6e 29 20 74 68  |rent version) th|
00001620  65 6e 20 6f 6e 6c 79 20  74 68 65 20 63 6f 6e 74  |en only the cont|
00001630  65 6e 74 73 20 6f 66 20  52 32 20 69 73 20 73 61  |ents of R2 is sa|
00001640  76 65 64 20 62 79 0a 74  68 65 20 6d 6f 64 75 6c  |ved by.the modul|
00001650  65 2e 20 54 68 69 73 20  66 65 61 74 75 72 65 20  |e. This feature |
00001660  61 6c 6c 6f 77 73 20 79  6f 75 20 74 6f 20 61 74  |allows you to at|
00001670  74 61 63 68 20 61 20 68  61 6e 64 6c 65 72 20 74  |tach a handler t|
00001680  6f 20 74 68 65 20 6d 65  6e 75 0a 69 74 65 6d 2e  |o the menu.item.|
00001690  20 49 6e 20 63 61 73 65  20 6f 66 20 22 42 41 53  | In case of "BAS|
000016a0  49 43 22 20 79 6f 75 20  63 61 6e 20 70 72 6f 76  |IC" you can prov|
000016b0  69 64 65 20 74 68 65 20  6e 61 6d 65 20 6f 66 20  |ide the name of |
000016c0  42 41 53 49 43 20 66 75  6e 63 74 69 6f 6e 2e 0a  |BASIC function..|
000016d0  49 6e 20 63 61 73 65 20  6f 66 20 22 6d 61 63 68  |In case of "mach|
000016e0  69 6e 65 20 63 6f 64 65  22 20 2d 20 74 68 65 20  |ine code" - the |
000016f0  61 64 64 72 65 73 73 20  6f 66 20 41 52 4d 20 73  |address of ARM s|
00001700  75 62 72 6f 75 74 69 6e  65 2e 20 53 65 65 20 61  |ubroutine. See a|
00001710  6c 73 6f 0a 4d 65 6e 75  55 74 69 6c 5f 44 65 63  |lso.MenuUtil_Dec|
00001720  6f 64 65 20 61 6e 64 20  66 6f 72 20 70 6f 73 73  |ode and for poss|
00001730  69 62 6c 65 20 75 73 65  20 6f 66 20 69 74 65 6d  |ible use of item|
00001740  20 68 61 6e 64 6c 65 72  73 2e 0a 20 20 20 20 20  | handlers..     |
00001750  20 20 20 20 20 20 20 20  20 20 0a 0a 20 45 78 61  |          .. Exa|
00001760  6d 70 6c 65 20 63 6f 64  65 3a 20 20 20 20 20 20  |mple code:      |
00001770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001780  20 20 20 20 20 20 20 20  0a 0a 20 41 64 64 20 69  |        .. Add i|
00001790  74 65 6d 20 22 49 6e 66  6f 22 20 74 6f 20 74 68  |tem "Info" to th|
000017a0  65 20 63 75 72 72 65 6e  74 20 6d 65 6e 75 0a 20  |e current menu. |
000017b0  53 59 53 20 22 4d 65 6e  75 55 74 69 6c 5f 41 64  |SYS "MenuUtil_Ad|
000017c0  64 22 2c 2c 22 49 6e 66  6f 22 20 54 4f 20 69 6e  |d",,"Info" TO in|
000017d0  66 6f 49 74 65 6d 25 20  20 20 20 0a 0a 20 41 64  |foItem%    .. Ad|
000017e0  64 20 69 74 65 6d 20 22  51 75 69 74 22 20 61 6e  |d item "Quit" an|
000017f0  64 20 74 68 65 6e 20 69  6e 73 65 72 74 20 69 74  |d then insert it|
00001800  65 6d 20 22 43 72 65 61  74 65 22 20 6a 75 73 74  |em "Create" just|
00001810  20 62 65 66 6f 72 65 20  69 74 2e 20 20 4c 65 74  | before it.  Let|
00001820  27 73 0a 74 68 65 20 66  69 72 73 74 20 69 74 65  |'s.the first ite|
00001830  6d 20 77 69 6c 6c 20 68  61 76 65 20 74 68 65 20  |m will have the |
00001840  68 61 6e 64 6c 65 72 2e  20 54 68 65 20 68 61 6e  |handler. The han|
00001850  64 6c 65 72 20 69 73 20  61 73 73 75 6d 65 64 20  |dler is assumed |
00001860  74 6f 20 62 65 0a 42 41  53 49 43 20 66 75 6e 63  |to be.BASIC func|
00001870  74 69 6f 6e 20 46 4e 71  75 69 74 2e 20 28 53 65  |tion FNquit. (Se|
00001880  65 20 4d 65 6e 75 55 74  69 6c 5f 44 65 63 6f 64  |e MenuUtil_Decod|
00001890  65 20 6f 6e 20 68 6f 77  20 74 68 69 73 20 68 61  |e on how this ha|
000018a0  6e 64 6c 65 72 20 6d 61  79 20 62 65 0a 63 61 6c  |ndler may be.cal|
000018b0  6c 65 64 29 20 0a 20 53  59 53 20 22 4d 65 6e 75  |led) . SYS "Menu|
000018c0  55 74 69 6c 5f 41 64 64  22 2c 2c 22 51 75 69 74  |Util_Add",,"Quit|
000018d0  22 2c 22 71 75 69 74 22  20 54 4f 20 71 75 69 74  |","quit" TO quit|
000018e0  49 74 65 6d 25 0a 20 53  59 53 20 22 4d 65 6e 75  |Item%. SYS "Menu|
000018f0  55 74 69 6c 5f 41 64 64  22 2c 71 75 69 74 49 74  |Util_Add",quitIt|
00001900  65 6d 25 2c 22 43 72 65  61 74 65 22 20 54 4f 20  |em%,"Create" TO |
00001910  63 72 65 61 74 65 49 74  65 6d 25 20 20 20 20 20  |createItem%     |
00001920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001930  20 20 20 20 20 20 20 20  20 20 20 20 20 0a 20 43  |             . C|
00001940  72 65 61 74 65 20 6d 65  6e 75 20 73 69 6d 69 6c  |reate menu simil|
00001950  61 72 20 74 6f 20 44 69  73 70 6c 61 79 20 73 75  |ar to Display su|
00001960  62 6d 65 6e 75 20 69 6e  20 46 69 6c 65 72 2e 20  |bmenu in Filer. |
00001970  57 68 65 6e 20 69 74 65  6d 73 20 61 72 65 20 61  |When items are a|
00001980  64 64 65 64 0a 74 6f 20  63 75 72 72 65 6e 74 20  |dded.to current |
00001990  6d 65 6e 75 20 6d 65 6e  75 20 68 61 6e 64 6c 65  |menu menu handle|
000019a0  20 28 64 69 73 70 4d 65  6e 75 25 29 20 6d 61 79  | (dispMenu%) may|
000019b0  20 62 65 20 6f 6d 69 74  74 65 64 20 61 73 20 69  | be omitted as i|
000019c0  74 20 77 69 6c 6c 20 62  65 0a 75 73 65 64 20 62  |t will be.used b|
000019d0  79 20 64 65 66 61 75 6c  74 2e 0a 20 53 59 53 20  |y default.. SYS |
000019e0  22 4d 65 6e 75 55 74 69  6c 5f 4e 65 77 22 2c 2c  |"MenuUtil_New",,|
000019f0  22 44 69 73 70 6c 61 79  22 20 54 4f 20 64 69 73  |"Display" TO dis|
00001a00  70 4d 65 6e 75 25 0a 20  53 59 53 20 22 4d 65 6e  |pMenu%. SYS "Men|
00001a10  75 55 74 69 6c 5f 41 64  64 22 2c 2c 22 4c 61 72  |uUtil_Add",,"Lar|
00001a20  67 65 20 69 63 6f 6e 73  22 20 54 4f 20 6c 61 72  |ge icons" TO lar|
00001a30  67 65 49 74 65 6d 25 0a  20 53 59 53 20 22 4d 65  |geItem%. SYS "Me|
00001a40  6e 75 55 74 69 6c 5f 41  64 64 22 2c 2c 22 53 6d  |nuUtil_Add",,"Sm|
00001a50  61 6c 6c 20 69 63 6f 6e  73 22 20 54 4f 20 73 6d  |all icons" TO sm|
00001a60  61 6c 6c 49 74 65 6d 25  0a 20 53 59 53 20 22 4d  |allItem%. SYS "M|
00001a70  65 6e 75 55 74 69 6c 5f  41 64 64 22 2c 2c 22 46  |enuUtil_Add",,"F|
00001a80  75 6c 6c 20 69 6e 66 6f  22 20 54 4f 20 66 75 6c  |ull info" TO ful|
00001a90  6c 49 74 65 6d 25 0a 0a  20 20 20 20 20 20 20 20  |lItem%..        |
00001aa0  20 20 0a 0a 0a 20 4d 65  6e 75 55 74 69 6c 5f 44  |  ... MenuUtil_D|
00001ab0  65 6c 65 74 65 20 28 53  57 49 20 26 34 35 42 43  |elete (SWI &45BC|
00001ac0  33 29 0a 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |3). ------------|
00001ad0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00001ae0  0a 20 52 65 6d 6f 76 65  73 20 6d 65 6e 75 20 6f  |. Removes menu o|
00001af0  72 20 6d 65 6e 75 20 69  74 65 6d 0a 0a 20 45 6e  |r menu item.. En|
00001b00  74 72 79 3a 0a 20 20 20  20 20 52 30 20 3d 20 68  |try:.     R0 = h|
00001b10  61 6e 64 6c 65 20 6f 66  20 74 68 65 20 6d 65 6e  |andle of the men|
00001b20  75 20 6f 72 20 6f 66 20  74 68 65 20 6d 65 6e 75  |u or of the menu|
00001b30  20 69 74 65 6d 20 6f 72  20 7a 65 72 6f 20 66 6f  | item or zero fo|
00001b40  72 20 63 75 72 72 65 6e  74 20 6d 65 6e 75 0a 20  |r current menu. |
00001b50  20 20 20 20 69 66 20 52  31 3c 3e 30 20 74 68 65  |    if R1<>0 the|
00001b60  6e 20 72 65 63 75 72 73  69 76 65 6c 79 20 64 65  |n recursively de|
00001b70  6c 65 74 65 20 61 6c 6c  20 73 75 62 6d 65 6e 75  |lete all submenu|
00001b80  73 20 0a 20 45 78 69 74  3a 0a 20 20 20 20 20 52  |s . Exit:.     R|
00001b90  30 2c 52 31 20 70 72 65  73 65 72 76 65 64 0a 0a  |0,R1 preserved..|
00001ba0  54 68 69 73 20 63 61 6c  6c 20 61 6c 6c 6f 77 73  |This call allows|
00001bb0  20 79 6f 75 20 74 6f 20  64 65 6c 65 74 65 20 74  | you to delete t|
00001bc0  68 65 20 77 68 6f 6c 65  20 6d 65 6e 75 20 6f 72  |he whole menu or|
00001bd0  20 74 68 65 20 70 61 72  74 69 63 75 6c 61 72 20  | the particular |
00001be0  6d 65 6e 75 20 69 74 65  6d 2e 0a 49 66 20 79 6f  |menu item..If yo|
00001bf0  75 20 77 69 6c 6c 20 64  65 6c 65 74 65 20 6d 65  |u will delete me|
00001c00  6e 75 20 69 74 65 6d 20  74 68 65 6e 20 72 65 6d  |nu item then rem|
00001c10  61 69 6e 65 64 20 69 74  65 6d 73 20 6f 66 20 74  |ained items of t|
00001c20  68 69 73 20 6d 65 6e 75  20 77 68 69 63 68 20 61  |his menu which a|
00001c30  72 65 0a 70 6f 73 69 74  69 6f 6e 65 64 20 62 65  |re.positioned be|
00001c40  6c 6c 6f 77 20 69 74 20  77 69 6c 6c 20 62 65 20  |llow it will be |
00001c50  61 75 74 6f 6d 61 74 69  63 61 6c 6c 79 20 73 68  |automatically sh|
00001c60  69 66 74 65 64 20 69 6e  20 6d 65 6d 6f 72 79 20  |ifted in memory |
00001c70  74 6f 20 66 69 6c 6c 20  74 68 65 0a 68 6f 6c 65  |to fill the.hole|
00001c80  2e 20 44 65 73 70 69 74  65 20 74 68 65 20 66 61  |. Despite the fa|
00001c90  63 74 20 74 68 61 74 20  6d 65 6d 6f 72 79 20 6c  |ct that memory l|
00001ca0  6f 63 61 74 69 6f 6e 20  61 6e 64 20 70 6f 73 69  |ocation and posi|
00001cb0  74 69 6f 6e 20 69 6e 20  6d 65 6e 75 20 6f 66 20  |tion in menu of |
00001cc0  73 6f 6d 65 0a 69 74 65  6d 73 20 6d 61 79 20 62  |some.items may b|
00001cd0  65 20 63 68 61 6e 67 65  64 20 74 68 65 20 68 61  |e changed the ha|
00001ce0  6e 64 6c 65 73 20 6f 66  20 74 68 65 20 69 74 65  |ndles of the ite|
00001cf0  6d 73 20 77 69 6c 6c 20  72 65 6d 61 69 6e 20 76  |ms will remain v|
00001d00  61 6c 69 64 2e 0a 0a 49  66 20 79 6f 75 20 77 61  |alid...If you wa|
00001d10  6e 74 20 74 6f 20 64 65  6c 65 74 65 20 6e 6f 74  |nt to delete not|
00001d20  20 6f 6e 6c 79 20 74 68  65 20 69 74 65 6d 20 62  | only the item b|
00001d30  75 74 20 61 6c 73 6f 20  74 68 65 20 77 68 6f 6c  |ut also the whol|
00001d40  65 20 6d 65 6e 75 20 73  75 62 74 72 65 65 0a 63  |e menu subtree.c|
00001d50  6f 6e 6e 65 63 74 65 64  20 77 69 74 68 20 69 74  |onnected with it|
00001d60  20 74 68 65 6e 20 79 6f  75 20 6d 75 73 74 20 73  | then you must s|
00001d70  65 74 20 52 31 3c 3e 30  20 6f 6e 20 65 6e 74 72  |et R1<>0 on entr|
00001d80  79 2e 20 49 66 20 52 30  20 63 6f 6e 74 61 69 6e  |y. If R0 contain|
00001d90  73 20 74 68 65 0a 68 61  6e 64 6c 65 20 6f 66 20  |s the.handle of |
00001da0  6d 65 6e 75 20 74 68 65  6e 20 74 68 69 73 20 6d  |menu then this m|
00001db0  65 6e 75 20 77 69 6c 6c  20 62 65 20 64 65 6c 65  |enu will be dele|
00001dc0  74 65 64 20 61 6c 6f 6e  65 20 6f 72 20 74 6f 67  |ted alone or tog|
00001dd0  65 74 68 65 72 20 77 69  74 68 20 61 6c 6c 0a 73  |ether with all.s|
00001de0  75 62 6d 65 6e 75 73 20  64 65 70 65 6e 64 69 6e  |ubmenus dependin|
00001df0  67 20 6f 6e 20 52 31 2e  20 0a 0a 55 73 65 20 72  |g on R1. ..Use r|
00001e00  65 63 75 72 73 69 76 65  20 64 65 6c 65 74 69 6f  |ecursive deletio|
00001e10  6e 20 77 69 74 68 20 63  61 75 74 69 6f 6e 20 61  |n with caution a|
00001e20  73 20 79 6f 75 20 6d 61  79 20 61 63 63 69 64 65  |s you may accide|
00001e30  6e 74 61 6c 6c 79 20 64  65 6c 65 74 65 0a 73 75  |ntally delete.su|
00001e40  62 6d 65 6e 75 73 20 77  68 69 63 68 20 61 72 65  |bmenus which are|
00001e50  20 63 6f 6e 6e 65 63 74  65 64 20 77 69 74 68 20  | connected with |
00001e60  6f 74 68 65 72 20 6d 65  6e 75 20 69 74 65 6d 73  |other menu items|
00001e70  2e 0a 0a 54 68 69 73 20  63 61 6c 6c 20 69 73 20  |...This call is |
00001e80  73 75 70 70 6f 73 65 64  20 74 6f 20 62 65 20 75  |supposed to be u|
00001e90  73 65 64 20 77 68 65 6e  20 6d 65 6e 75 73 20 77  |sed when menus w|
00001ea0  69 74 68 20 76 61 72 69  61 62 6c 65 20 6e 75 6d  |ith variable num|
00001eb0  62 65 72 20 6f 66 20 69  74 65 6d 73 0a 61 72 65  |ber of items.are|
00001ec0  20 6e 65 65 64 65 64 2e  20 49 74 20 6d 61 79 20  | needed. It may |
00001ed0  62 65 20 66 6f 72 20 65  78 61 6d 70 6c 65 20 6d  |be for example m|
00001ee0  65 6e 75 20 77 69 74 68  20 74 68 65 20 6c 69 73  |enu with the lis|
00001ef0  74 20 6f 66 20 63 75 72  72 65 6e 74 6c 79 20 6f  |t of currently o|
00001f00  70 65 6e 65 64 0a 64 6f  63 75 6d 65 6e 74 73 20  |pened.documents |
00001f10  6f 72 20 61 72 63 68 69  76 65 73 2e 0a 0a 20 45  |or archives... E|
00001f20  78 61 6d 70 6c 65 20 63  6f 64 65 3a 0a 20 44 65  |xample code:. De|
00001f30  6c 65 74 65 20 69 74 65  6d 20 77 69 74 68 20 68  |lete item with h|
00001f40  61 6e 64 6c 65 20 74 6d  70 49 74 65 6d 25 0a 20  |andle tmpItem%. |
00001f50  53 59 53 20 22 4d 65 6e  75 55 74 69 6c 5f 44 65  |SYS "MenuUtil_De|
00001f60  6c 65 74 65 22 2c 74 6d  70 49 74 65 6d 25 0a 0a  |lete",tmpItem%..|
00001f70  20 52 65 63 75 72 73 69  76 65 6c 79 20 64 65 6c  | Recursively del|
00001f80  65 74 65 20 61 6c 6c 20  6d 65 6e 75 73 20 6c 69  |ete all menus li|
00001f90  6e 6b 65 64 20 77 69 74  68 20 6d 61 69 6e 4d 65  |nked with mainMe|
00001fa0  6e 75 25 0a 20 53 59 53  20 22 4d 65 6e 75 55 74  |nu%. SYS "MenuUt|
00001fb0  69 6c 5f 44 65 6c 65 74  65 22 2c 6d 61 69 6e 4d  |il_Delete",mainM|
00001fc0  65 6e 75 25 2c 54 52 55  45 0a 20 20 20 20 20 0a  |enu%,TRUE.     .|
00001fd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001ff0  20 20 20 20 20 20 20 0a  0a 0a 0a 0a 20 4d 65 6e  |       ..... Men|
00002000  75 55 74 69 6c 5f 44 65  63 6f 64 65 20 28 53 57  |uUtil_Decode (SW|
00002010  49 20 26 34 35 42 43 34  29 0a 20 2d 2d 2d 2d 2d  |I &45BC4). -----|
00002020  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002030  2d 2d 2d 2d 2d 2d 2d 0a  20 44 65 63 6f 64 65 73  |-------. Decodes|
00002040  20 6d 65 6e 75 20 61 66  74 65 72 20 75 73 65 72  | menu after user|
00002050  20 73 65 6c 65 63 74 69  6f 6e 2e 0a 0a 20 45 6e  | selection... En|
00002060  74 72 79 3a 0a 0a 20 20  20 20 20 52 30 20 3d 20  |try:..     R0 = |
00002070  6d 65 6e 75 20 68 61 6e  64 6c 65 20 6f 72 20 7a  |menu handle or z|
00002080  65 72 6f 20 69 66 20 63  75 72 72 65 6e 74 20 6d  |ero if current m|
00002090  65 6e 75 0a 20 20 20 20  20 52 31 20 2d 3e 20 70  |enu.     R1 -> p|
000020a0  6f 69 6e 74 65 72 20 74  6f 20 74 68 65 20 6c 69  |ointer to the li|
000020b0  73 74 20 6f 66 20 6d 65  6e 75 20 73 65 6c 65 63  |st of menu selec|
000020c0  74 69 6f 6e 73 0a 20 45  78 69 74 3a 0a 20 20 20  |tions. Exit:.   |
000020d0  20 20 52 30 20 2d 3e 20  70 6f 69 6e 74 65 72 20  |  R0 -> pointer |
000020e0  74 6f 20 69 74 65 6d 20  68 61 6e 64 6c 65 72 20  |to item handler |
000020f0  6f 72 20 7a 65 72 6f 0a  20 20 20 20 20 52 31 20  |or zero.     R1 |
00002100  2d 3e 20 54 52 55 45 20  69 66 20 73 65 6c 65 63  |-> TRUE if selec|
00002110  74 69 6f 6e 20 77 61 73  20 6d 61 64 65 20 77 69  |tion was made wi|
00002120  74 68 20 41 44 4a 55 53  54 2e 20 28 75 6e 64 6f  |th ADJUST. (undo|
00002130  63 75 6d 65 6e 74 65 64  2c 20 62 75 74 0a 20 20  |cumented, but.  |
00002140  20 20 20 20 20 20 20 20  20 75 73 65 64 20 69 6e  |         used in|
00002150  20 21 54 65 6d 70 6c 45  64 29 20 0a 20 20 20 20  | !TemplEd) .    |
00002160  20 52 32 20 2d 3e 20 70  6f 69 6e 74 65 72 20 74  | R2 -> pointer t|
00002170  6f 20 62 6c 6f 63 6b 20  28 6f 72 69 67 69 6e 61  |o block (origina|
00002180  6c 20 64 6f 63 73 20 73  61 69 64 20 74 68 69 73  |l docs said this|
00002190  20 77 61 73 20 72 65 74  75 72 6e 65 64 20 69 6e  | was returned in|
000021a0  20 52 31 20 2d 0a 20 20  20 20 20 20 20 20 20 20  | R1 -.          |
000021b0  20 74 68 69 73 20 61 70  70 65 61 72 73 20 74 6f  | this appears to|
000021c0  20 62 65 20 69 6e 63 6f  72 72 65 63 74 21 29 0a  | be incorrect!).|
000021d0  0a 42 6c 6f 63 6b 20 70  6f 69 6e 74 65 64 20 74  |.Block pointed t|
000021e0  6f 20 62 79 20 52 31 20  6d 75 73 74 20 63 6f 6e  |o by R1 must con|
000021f0  74 61 69 6e 20 74 68 65  20 6c 69 73 74 20 6f 66  |tain the list of|
00002200  20 6d 65 6e 75 20 73 65  6c 65 63 74 69 6f 6e 73  | menu selections|
00002210  20 69 6e 20 74 68 65 20  73 61 6d 65 0a 66 6f 72  | in the same.for|
00002220  6d 61 74 20 61 73 20 72  65 74 75 72 6e 65 64 20  |mat as returned |
00002230  62 79 20 57 69 6d 70 5f  50 6f 6c 6c 20 69 6e 20  |by Wimp_Poll in |
00002240  63 61 73 65 20 6f 66 20  6d 65 6e 75 20 73 65 6c  |case of menu sel|
00002250  65 63 74 69 6f 6e 20 65  76 65 6e 74 2e 20 0a 0a  |ection event. ..|
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 52  |               R|
00002270  31 20 2b 20 30 20 20 69  74 65 6d 20 69 6e 20 6d  |1 + 0  item in m|
00002280  61 69 6e 20 6d 65 6e 75  20 77 68 69 63 68 20 77  |ain menu which w|
00002290  61 73 20 73 65 6c 65 63  74 65 64 20 28 73 74 61  |as selected (sta|
000022a0  72 74 69 6e 67 20 66 72  6f 6d 20 30 29 0a 20 20  |rting from 0).  |
000022b0  20 20 20 20 20 20 20 20  20 20 20 20 20 52 31 20  |             R1 |
000022c0  2b 20 34 20 20 69 74 65  6d 20 69 6e 20 66 69 72  |+ 4  item in fir|
000022d0  73 74 20 73 75 62 6d 65  6e 75 20 77 68 69 63 68  |st submenu which|
000022e0  20 77 61 73 20 73 65 6c  65 63 74 65 64 0a 20 20  | was selected.  |
000022f0  20 20 20 20 20 20 20 20  20 20 20 20 20 52 31 20  |             R1 |
00002300  2b 20 38 20 20 69 74 65  6d 20 69 6e 20 73 65 63  |+ 8  item in sec|
00002310  6f 6e 64 20 73 75 62 6d  65 6e 75 20 77 68 69 63  |ond submenu whic|
00002320  68 20 77 61 73 20 73 65  6c 65 63 74 65 64 0a 20  |h was selected. |
00002330  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002340  20 20 20 20 20 20 2e 2e  2e 0a 20 20 20 20 20 20  |      ....      |
00002350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002360  20 74 65 72 6d 69 6e 61  74 65 64 20 62 79 20 2d  | terminated by -|
00002370  31 0a 0a 54 68 69 73 20  63 61 6c 6c 20 6d 61 70  |1..This call map|
00002380  73 20 74 68 65 20 6c 69  73 74 20 6f 66 20 6d 65  |s the list of me|
00002390  6e 75 20 73 65 6c 65 63  74 69 6f 6e 73 20 6f 6e  |nu selections on|
000023a0  74 6f 20 6d 65 6e 75 20  64 61 74 61 20 73 74 72  |to menu data str|
000023b0  75 63 74 75 72 65 20 61  6e 64 0a 64 65 74 65 72  |ucture and.deter|
000023c0  6d 69 6e 65 73 20 63 6f  72 72 65 73 70 6f 6e 64  |mines correspond|
000023d0  69 6e 67 20 6d 65 6e 75  20 69 74 65 6d 73 2e 20  |ing menu items. |
000023e0  56 61 72 69 6f 75 73 20  69 6e 66 6f 72 6d 61 74  |Various informat|
000023f0  69 6f 6e 20 61 62 6f 75  74 20 6c 61 73 74 20 74  |ion about last t|
00002400  77 6f 0a 69 74 65 6d 73  20 66 72 6f 6d 20 74 68  |wo.items from th|
00002410  69 73 20 6c 69 73 74 20  28 73 65 6c 65 63 74 65  |is list (selecte|
00002420  64 20 69 74 65 6d 20 61  6e 64 20 70 61 72 65 6e  |d item and paren|
00002430  74 20 69 74 65 6d 20 66  72 6f 6d 20 6d 65 6e 75  |t item from menu|
00002440  20 6f 6e 65 20 6c 65 76  65 6c 20 75 70 0a 69 66  | one level up.if|
00002450  20 61 6e 79 29 20 69 73  20 77 72 69 74 74 65 6e  | any) is written|
00002460  20 69 6e 74 6f 20 73 70  65 63 69 61 6c 20 62 6c  | into special bl|
00002470  6f 63 6b 2e 20 50 6f 69  6e 74 65 72 20 74 6f 20  |ock. Pointer to |
00002480  74 68 69 73 20 62 6c 6f  63 6b 20 69 73 20 72 65  |this block is re|
00002490  74 75 72 6e 65 64 20 69  6e 0a 52 31 2e 20 46 6f  |turned in.R1. Fo|
000024a0  72 6d 61 74 20 6f 66 20  74 68 65 20 72 65 74 75  |rmat of the retu|
000024b0  72 6e 65 64 20 62 6c 6f  63 6b 20 69 73 20 61 73  |rned block is as|
000024c0  20 66 6f 6c 6c 6f 77 73  3a 20 0a 0a 20 52 31 2b  | follows: .. R1+|
000024d0  30 20 20 70 6f 73 69 74  69 6f 6e 20 6f 66 20 73  |0  position of s|
000024e0  65 6c 65 63 74 65 64 20  6d 65 6e 75 20 69 74 65  |elected menu ite|
000024f0  6d 20 69 6e 20 6d 65 6e  75 20 28 73 74 61 72 74  |m in menu (start|
00002500  69 6e 67 20 66 72 6f 6d  20 30 29 0a 20 52 31 2b  |ing from 0). R1+|
00002510  34 20 20 70 6f 69 6e 74  65 72 20 74 6f 20 73 65  |4  pointer to se|
00002520  6c 65 63 74 65 64 20 69  74 65 6d 20 64 61 74 61  |lected item data|
00002530  0a 20 52 31 2b 38 20 20  73 65 6c 65 63 74 65 64  |. R1+8  selected|
00002540  20 69 74 65 6d 20 68 61  6e 64 6c 65 20 6f 72 20  | item handle or |
00002550  7a 65 72 6f 20 69 66 20  69 74 65 6d 20 77 61 73  |zero if item was|
00002560  20 63 72 65 61 74 65 64  20 77 69 74 68 6f 75 74  | created without|
00002570  20 4d 65 6e 75 55 74 69  6c 73 0a 20 52 31 2b 31  | MenuUtils. R1+1|
00002580  32 20 70 6f 69 6e 74 65  72 20 74 6f 20 74 65 78  |2 pointer to tex|
00002590  74 20 73 74 72 69 6e 67  20 6f 66 20 73 65 6c 65  |t string of sele|
000025a0  63 74 65 64 20 69 74 65  6d 0a 20 52 31 2b 31 36  |cted item. R1+16|
000025b0  20 70 6f 73 69 74 69 6f  6e 20 6f 66 20 70 61 72  | position of par|
000025c0  65 6e 74 20 6d 65 6e 75  20 69 74 65 6d 20 69 6e  |ent menu item in|
000025d0  20 6d 65 6e 75 20 28 73  74 61 72 74 69 6e 67 20  | menu (starting |
000025e0  66 72 6f 6d 20 30 29 0a  20 52 31 2b 32 30 20 70  |from 0). R1+20 p|
000025f0  6f 69 6e 74 65 72 20 74  6f 20 70 61 72 65 6e 74  |ointer to parent|
00002600  20 69 74 65 6d 20 64 61  74 61 0a 20 52 31 2b 32  | item data. R1+2|
00002610  34 20 70 61 72 65 6e 74  20 69 74 65 6d 20 68 61  |4 parent item ha|
00002620  6e 64 6c 65 20 6f 72 20  7a 65 72 6f 20 69 66 20  |ndle or zero if |
00002630  69 74 65 6d 20 77 61 73  20 63 72 65 61 74 65 64  |item was created|
00002640  20 77 69 74 68 6f 75 74  20 4d 65 6e 75 55 74 69  | without MenuUti|
00002650  6c 73 0a 20 52 31 2b 32  38 20 70 6f 69 6e 74 65  |ls. R1+28 pointe|
00002660  72 20 74 6f 20 74 65 78  74 20 73 74 72 69 6e 67  |r to text string|
00002670  20 6f 66 20 70 61 72 65  6e 74 20 69 74 65 6d 20  | of parent item |
00002680  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002690  20 20 20 20 20 20 20 20  0a 0a 49 66 20 74 68 65  |        ..If the|
000026a0  20 69 74 65 6d 20 68 61  73 20 62 65 65 6e 20 73  | item has been s|
000026b0  65 6c 65 63 74 65 64 20  66 72 6f 6d 20 74 68 65  |elected from the|
000026c0  20 74 6f 70 2d 6c 65 76  65 6c 20 6d 65 6e 75 20  | top-level menu |
000026d0  74 68 65 6e 20 74 68 65  72 65 20 77 69 6c 6c 20  |then there will |
000026e0  62 65 20 6e 6f 0a 70 61  72 65 6e 74 20 69 74 65  |be no.parent ite|
000026f0  6d 20 61 6e 64 20 63 6f  72 72 65 73 70 6f 6e 64  |m and correspond|
00002700  69 6e 67 20 70 61 72 74  20 6f 66 20 74 68 65 20  |ing part of the |
00002710  62 6c 6f 63 6b 20 77 69  6c 6c 20 62 65 20 66 69  |block will be fi|
00002720  6c 6c 65 64 20 77 69 74  68 20 7a 65 72 6f 73 2e  |lled with zeros.|
00002730  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002780  20 20 20 20 20 0a 49 66  20 64 75 72 69 6e 67 20  |     .If during |
00002790  63 72 65 61 74 69 6f 6e  20 6f 66 20 74 68 69 73  |creation of this|
000027a0  20 69 74 65 6d 20 79 6f  75 20 68 61 76 65 20 73  | item you have s|
000027b0  70 65 63 69 66 69 65 64  20 74 68 65 20 68 61 6e  |pecified the han|
000027c0  64 6c 65 72 20 74 68 65  6e 20 52 30 20 6f 6e 0a  |dler then R0 on.|
000027d0  65 78 69 74 20 77 69 6c  6c 20 63 6f 6e 74 61 69  |exit will contai|
000027e0  6e 20 74 68 65 20 70 6f  69 6e 74 65 72 20 74 6f  |n the pointer to|
000027f0  20 74 68 69 73 20 68 61  6e 64 6c 65 72 20 6f 74  | this handler ot|
00002800  68 65 72 77 69 73 65 20  52 30 20 77 69 6c 6c 20  |herwise R0 will |
00002810  62 65 20 7a 65 72 6f 2e  0a 49 6e 74 65 72 70 72  |be zero..Interpr|
00002820  65 74 61 74 69 6f 6e 20  6f 66 20 69 74 65 6d 20  |etation of item |
00002830  68 61 6e 64 6c 65 72 20  69 73 20 64 65 74 65 72  |handler is deter|
00002840  6d 65 6e 74 20 62 79 20  69 6e 69 74 69 61 6c 69  |ment by initiali|
00002850  73 61 74 69 6f 6e 20 74  79 70 65 20 28 73 65 65  |sation type (see|
00002860  0a 4d 65 6e 75 55 74 69  6c 5f 49 6e 69 74 69 61  |.MenuUtil_Initia|
00002870  6c 69 73 65 29 2e 20 49  66 20 69 6e 69 74 69 61  |lise). If initia|
00002880  6c 69 73 61 74 69 6f 6e  20 74 79 70 65 20 77 61  |lisation type wa|
00002890  73 20 22 42 41 53 49 43  22 20 74 68 65 6e 20 52  |s "BASIC" then R|
000028a0  30 20 77 69 6c 6c 20 70  6f 69 6e 74 20 74 6f 0a  |0 will point to.|
000028b0  63 74 72 6c 2d 74 65 72  6d 69 6e 61 74 65 64 20  |ctrl-terminated |
000028c0  74 65 78 74 20 73 74 72  69 6e 67 2e 20 49 66 20  |text string. If |
000028d0  69 6e 69 74 69 61 6c 69  73 61 74 69 6f 6e 20 74  |initialisation t|
000028e0  79 70 65 20 77 61 73 20  22 6d 61 63 68 69 6e 65  |ype was "machine|
000028f0  20 63 6f 64 65 22 20 28  6e 6f 74 0a 73 75 70 70  | code" (not.supp|
00002900  6f 72 74 65 64 20 62 79  20 63 75 72 72 65 6e 74  |orted by current|
00002910  20 76 65 72 73 69 6f 6e  29 20 74 68 65 6e 20 52  | version) then R|
00002920  30 20 77 69 6c 6c 20 63  6f 6e 74 61 69 6e 20 74  |0 will contain t|
00002930  68 65 20 76 61 6c 75 65  20 70 61 73 73 65 64 20  |he value passed |
00002940  69 6e 20 52 32 20 74 6f  0a 4d 65 6e 75 55 74 69  |in R2 to.MenuUti|
00002950  6c 5f 41 64 64 2e 20 54  6f 20 69 6e 76 6f 6b 65  |l_Add. To invoke|
00002960  20 42 41 53 49 43 20 68  61 6e 64 6c 65 72 20 79  | BASIC handler y|
00002970  6f 75 20 63 61 6e 20 75  73 65 20 45 56 41 4c 20  |ou can use EVAL |
00002980  73 74 61 74 65 6d 65 6e  74 2e 0a 0a 45 78 61 6d  |statement...Exam|
00002990  70 6c 65 20 63 6f 64 65  3a 0a 20 53 75 70 70 6f  |ple code:. Suppo|
000029a0  73 65 20 57 69 6d 70 5f  50 6f 6c 6c 20 68 61 73  |se Wimp_Poll has|
000029b0  20 72 65 74 75 72 6e 65  64 20 72 65 61 73 6f 6e  | returned reason|
000029c0  20 63 6f 64 65 20 39 20  28 4d 65 6e 75 5f 53 65  | code 9 (Menu_Se|
000029d0  6c 65 63 74 69 6f 6e 29  20 61 6e 64 20 71 25 0a  |lection) and q%.|
000029e0  70 6f 69 6e 74 73 20 74  6f 20 74 68 65 20 63 6f  |points to the co|
000029f0  72 72 65 73 70 6f 6e 64  69 6e 67 20 62 6c 6f 63  |rresponding bloc|
00002a00  6b 2e 20 59 6f 75 20 63  61 6e 20 75 73 65 20 4d  |k. You can use M|
00002a10  65 6e 75 55 74 69 6c 5f  44 65 63 6f 64 65 20 74  |enuUtil_Decode t|
00002a20  6f 20 63 61 6c 6c 20 74  68 65 0a 69 74 65 6d 20  |o call the.item |
00002a30  68 61 6e 64 6c 65 72 20  69 6e 20 74 68 65 20 66  |handler in the f|
00002a40  6f 6c 6c 6f 77 69 6e 67  20 77 61 79 3a 0a 20 53  |ollowing way:. S|
00002a50  59 53 20 22 4d 65 6e 75  55 74 69 6c 5f 44 65 63  |YS "MenuUtil_Dec|
00002a60  6f 64 65 22 2c 2c 71 25  20 54 4f 20 68 61 6e 64  |ode",,q% TO hand|
00002a70  6c 65 72 25 20 20 20 20  20 20 20 20 20 20 20 20  |ler%            |
00002a80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002a90  0a 20 49 46 20 68 61 6e  64 6c 65 72 25 20 54 48  |. IF handler% TH|
00002aa0  45 4e 0a 20 20 20 68 61  6e 64 6c 65 72 24 3d 22  |EN.   handler$="|
00002ab0  46 4e 22 2b 24 68 61 6e  64 6c 65 72 25 0a 20 20  |FN"+$handler%.  |
00002ac0  20 49 46 20 45 56 41 4c  28 68 61 6e 64 6c 65 72  | IF EVAL(handler|
00002ad0  24 29 0a 20 45 4e 44 49  46 0a 20 20 20 20 20 20  |$). ENDIF.      |
00002ae0  20 20 20 20 20 20 20 20  20 20 0a 0a 0a 0a 0a 20  |          ..... |
00002af0  4d 65 6e 75 55 74 69 6c  5f 53 68 6f 77 20 28 53  |MenuUtil_Show (S|
00002b00  57 49 20 26 34 35 42 43  35 29 0a 20 2d 2d 2d 2d  |WI &45BC5). ----|
00002b10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00002b20  2d 2d 2d 2d 2d 2d 0a 20  44 69 73 70 6c 61 79 73  |------. Displays|
00002b30  20 6d 65 6e 75 20 6f 6e  20 73 63 72 65 65 6e 0a  | menu on screen.|
00002b40  0a 20 45 6e 74 72 79 3a  0a 20 20 20 20 20 52 30  |. Entry:.     R0|
00002b50  20 3d 20 68 61 6e 64 6c  65 20 6f 66 20 74 68 65  | = handle of the|
00002b60  20 6d 65 6e 75 20 6f 72  20 7a 65 72 6f 20 66 6f  | menu or zero fo|
00002b70  72 20 63 75 72 72 65 6e  74 20 6d 65 6e 75 0a 20  |r current menu. |
00002b80  20 20 20 20 52 31 20 2d  3e 20 70 6f 69 6e 74 65  |    R1 -> pointe|
00002b90  72 20 74 6f 20 62 6c 6f  63 6b 20 6f 72 20 7a 65  |r to block or ze|
00002ba0  72 6f 0a 20 45 78 69 74  3a 0a 20 20 20 20 20 52  |ro. Exit:.     R|
00002bb0  30 2c 52 31 20 70 72 65  73 65 72 76 65 64 0a 0a  |0,R1 preserved..|
00002bc0  54 68 69 73 20 63 61 6c  6c 20 6d 61 79 20 62 65  |This call may be|
00002bd0  20 75 73 65 64 20 74 6f  20 64 69 73 70 6c 61 79  | used to display|
00002be0  20 6d 65 6e 75 20 6f 6e  20 73 63 72 65 65 6e 2e  | menu on screen.|
00002bf0  20 53 63 72 65 65 6e 20  70 6f 73 69 74 69 6f 6e  | Screen position|
00002c00  20 66 6f 72 20 6d 65 6e  75 0a 77 69 6c 6c 20 62  | for menu.will b|
00002c10  65 20 63 61 6c 63 75 6c  61 74 65 64 20 61 63 63  |e calculated acc|
00002c20  6f 72 64 69 6e 67 20 74  6f 20 72 75 6c 65 73 20  |ording to rules |
00002c30  64 65 73 63 72 69 62 65  64 20 69 6e 20 50 52 4d  |described in PRM|
00002c40  2e 20 42 6c 6f 63 6b 20  70 6f 69 6e 74 65 64 20  |. Block pointed |
00002c50  74 6f 20 62 79 0a 52 31  20 6d 75 73 74 20 63 6f  |to by.R1 must co|
00002c60  6e 74 61 69 6e 20 74 68  65 20 73 61 6d 65 20 69  |ntain the same i|
00002c70  6e 66 6f 72 6d 61 74 69  6f 6e 20 61 73 20 72 65  |nformation as re|
00002c80  74 75 72 6e 65 64 20 62  79 20 57 69 6d 70 5f 50  |turned by Wimp_P|
00002c90  6f 6c 6c 20 69 6e 20 63  61 73 65 20 6f 66 0a 6d  |oll in case of.m|
00002ca0  6f 75 73 65 20 63 6c 69  63 6b 20 65 76 65 6e 74  |ouse click event|
00002cb0  20 28 69 6e 20 66 61 63  74 20 6f 6e 6c 79 20 6d  | (in fact only m|
00002cc0  6f 75 73 65 20 63 6f 6f  72 64 69 6e 61 74 65 73  |ouse coordinates|
00002cd0  20 61 6e 64 20 77 69 6e  64 6f 77 20 68 61 6e 64  | and window hand|
00002ce0  6c 65 20 77 69 6c 6c 20  62 65 0a 75 73 65 64 29  |le will be.used)|
00002cf0  20 3a 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  | :.             |
00002d00  20 20 20 20 20 20 20 20  52 31 20 2b 20 30 20 20  |        R1 + 0  |
00002d10  6d 6f 75 73 65 20 58 0a  20 20 20 20 20 20 20 20  |mouse X.        |
00002d20  20 20 20 20 20 20 20 20  20 20 20 20 20 52 31 20  |             R1 |
00002d30  2b 20 34 20 20 6d 6f 75  73 65 20 59 0a 20 20 20  |+ 4  mouse Y.   |
00002d40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002d50  20 20 52 31 20 2b 20 38  20 20 62 75 74 74 6f 6e  |  R1 + 8  button|
00002d60  73 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s.              |
00002d70  20 20 20 20 20 20 20 52  31 20 2b 31 32 20 20 77  |       R1 +12  w|
00002d80  69 6e 64 6f 77 20 68 61  6e 64 6c 65 20 28 2d 32  |indow handle (-2|
00002d90  20 69 66 20 69 63 6f 6e  20 62 61 72 29 0a 20 20  | if icon bar).  |
00002da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002db0  20 20 20 52 31 20 2b 31  36 20 20 69 63 6f 6e 20  |   R1 +16  icon |
00002dc0  68 61 6e 64 6c 65 20 20  20 20 20 20 20 20 20 20  |handle          |
00002dd0  20 20 20 20 20 20 0a 0a  4d 65 6e 75 55 74 69 6c  |      ..MenuUtil|
00002de0  73 20 61 75 74 6f 6d 61  74 69 63 61 6c 6c 79 20  |s automatically |
00002df0  64 69 73 74 69 6e 67 75  69 73 68 65 73 20 69 63  |distinguishes ic|
00002e00  6f 6e 62 61 72 20 6d 65  6e 75 73 20 66 72 6f 6d  |onbar menus from|
00002e10  20 6f 72 64 69 6e 61 72  79 0a 77 69 6e 64 6f 77  | ordinary.window|
00002e20  20 6d 65 6e 75 73 2e 20  49 66 20 6d 65 6e 75 20  | menus. If menu |
00002e30  69 73 20 61 6c 72 65 61  64 79 20 6f 6e 20 73 63  |is already on sc|
00002e40  72 65 65 6e 20 61 6e 64  20 79 6f 75 20 77 61 6e  |reen and you wan|
00002e50  74 20 74 6f 20 72 65 6f  70 65 6e 20 69 74 0a 61  |t to reopen it.a|
00002e60  66 74 65 72 20 75 73 65  72 20 73 65 6c 65 63 74  |fter user select|
00002e70  69 6f 6e 20 77 69 74 68  20 41 64 6a 75 73 74 20  |ion with Adjust |
00002e80  62 75 74 74 6f 6e 20 74  68 65 6e 20 70 6f 69 6e  |button then poin|
00002e90  74 65 72 20 74 6f 20 74  68 65 20 62 6c 6f 63 6b  |ter to the block|
00002ea0  20 6d 61 79 20 62 65 0a  6f 6d 69 74 74 65 64 2e  | may be.omitted.|
00002eb0  0a 0a 20 45 78 61 6d 70  6c 65 20 63 6f 64 65 3a  |.. Example code:|
00002ec0  0a 20 53 75 70 70 6f 73  65 20 57 69 6d 70 5f 50  |. Suppose Wimp_P|
00002ed0  6f 6c 6c 20 68 61 73 20  72 65 74 75 72 6e 65 64  |oll has returned|
00002ee0  20 72 65 61 73 6f 6e 20  63 6f 64 65 20 36 20 28  | reason code 6 (|
00002ef0  4d 6f 75 73 65 5f 43 6c  69 63 6b 29 20 61 6e 64  |Mouse_Click) and|
00002f00  20 71 25 20 70 6f 69 6e  74 73 20 74 6f 0a 74 68  | q% points to.th|
00002f10  65 20 72 65 74 75 72 6e  65 64 20 62 6c 6f 63 6b  |e returned block|
00002f20  2e 20 44 69 73 70 6c 61  79 20 6d 65 6e 75 20 6f  |. Display menu o|
00002f30  6e 20 73 63 72 65 65 6e  20 69 66 20 74 68 65 20  |n screen if the |
00002f40  63 6c 69 63 6b 20 69 73  20 77 69 74 68 20 4d 65  |click is with Me|
00002f50  6e 75 20 62 75 74 74 6f  6e 2e 0a 20 62 75 74 74  |nu button.. butt|
00002f60  6f 6e 73 25 3d 71 25 21  38 0a 20 49 46 20 28 62  |ons%=q%!8. IF (b|
00002f70  75 74 74 6f 6e 73 25 20  41 4e 44 32 29 3c 3e 30  |uttons% AND2)<>0|
00002f80  20 54 48 45 4e 20 53 59  53 20 22 4d 65 6e 75 55  | THEN SYS "MenuU|
00002f90  74 69 6c 5f 53 68 6f 77  22 2c 6d 61 69 6e 4d 65  |til_Show",mainMe|
00002fa0  6e 75 25 2c 71 25 0a 20  20 0a 20 4c 65 61 76 65  |nu%,q%.  . Leave|
00002fb0  20 6d 65 6e 75 20 6f 6e  20 73 63 72 65 65 6e 20  | menu on screen |
00002fc0  61 66 74 65 72 20 73 65  6c 65 63 74 69 6f 6e 20  |after selection |
00002fd0  77 69 74 68 20 41 64 6a  75 73 74 20 62 75 74 74  |with Adjust butt|
00002fe0  6f 6e 0a 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |on. SYS "MenuUti|
00002ff0  6c 5f 53 68 6f 77 22 0a  0a 0a 0a 0a 20 4d 65 6e  |l_Show"..... Men|
00003000  75 55 74 69 6c 5f 53 68  6f 77 53 75 62 4d 65 6e  |uUtil_ShowSubMen|
00003010  75 20 28 53 57 49 20 26  34 35 42 43 36 29 0a 20  |u (SWI &45BC6). |
00003020  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00003040  2d 0a 20 44 69 73 70 6c  61 79 20 73 75 62 6d 65  |-. Display subme|
00003050  6e 75 20 61 66 74 65 72  20 72 65 63 65 69 76 69  |nu after receivi|
00003060  6e 67 20 4d 65 73 73 61  67 65 5f 4d 65 6e 75 57  |ng Message_MenuW|
00003070  61 72 6e 69 6e 67 0a 20  0a 20 45 6e 74 72 79 3a  |arning. . Entry:|
00003080  0a 20 20 20 20 20 52 30  20 3d 20 68 61 6e 64 6c  |.     R0 = handl|
00003090  65 20 6f 66 20 74 68 65  20 73 75 62 6d 65 6e 75  |e of the submenu|
000030a0  20 6f 72 20 7a 65 72 6f  20 66 6f 72 20 63 75 72  | or zero for cur|
000030b0  72 65 6e 74 20 6d 65 6e  75 0a 20 20 20 20 20 52  |rent menu.     R|
000030c0  31 20 2d 3e 20 70 6f 69  6e 74 65 72 20 74 6f 20  |1 -> pointer to |
000030d0  62 6c 6f 63 6b 0a 20 45  78 69 74 3a 0a 20 20 20  |block. Exit:.   |
000030e0  20 20 52 30 2c 52 31 20  70 72 65 73 65 72 76 65  |  R0,R1 preserve|
000030f0  64 0a 0a 54 68 69 73 20  63 61 6c 6c 20 6d 61 79  |d..This call may|
00003100  20 62 65 20 75 73 65 64  20 74 6f 20 64 69 73 70  | be used to disp|
00003110  6c 61 79 20 73 75 62 6d  65 6e 75 20 77 68 65 6e  |lay submenu when|
00003120  20 61 20 6d 65 73 73 61  67 65 20 74 79 70 65 20  | a message type |
00003130  4d 65 6e 75 57 61 72 6e  69 6e 67 0a 28 26 34 30  |MenuWarning.(&40|
00003140  30 43 30 29 20 69 73 20  72 65 63 65 69 76 65 64  |0C0) is received|
00003150  20 62 79 20 61 6e 20 61  70 70 6c 69 63 61 74 69  | by an applicati|
00003160  6f 6e 2e 20 54 68 69 73  20 6d 65 73 73 61 67 65  |on. This message|
00003170  20 69 73 20 73 65 6e 74  20 62 79 20 74 68 65 20  | is sent by the |
00003180  57 69 6d 70 0a 77 68 65  6e 20 73 75 62 6d 65 6e  |Wimp.when submen|
00003190  75 20 69 73 20 61 62 6f  75 74 20 74 6f 20 62 65  |u is about to be|
000031a0  20 61 63 63 65 73 73 65  64 20 62 79 20 74 68 65  | accessed by the|
000031b0  20 70 6f 69 6e 74 65 72  20 6d 6f 76 69 6e 67 20  | pointer moving |
000031c0  6f 76 65 72 20 74 68 65  0a 72 69 67 68 74 2d 70  |over the.right-p|
000031d0  6f 69 6e 74 69 6e 67 20  61 72 72 6f 77 20 6f 66  |ointing arrow of|
000031e0  20 74 68 65 20 70 61 72  65 6e 74 20 6d 65 6e 75  | the parent menu|
000031f0  2e 20 28 54 6f 20 66 69  6e 64 20 6f 75 74 20 74  |. (To find out t|
00003200  68 65 20 68 61 6e 64 6c  65 20 6f 66 20 74 68 65  |he handle of the|
00003210  0a 6d 65 6e 75 20 69 74  65 6d 20 69 6e 20 70 61  |.menu item in pa|
00003220  72 65 6e 74 20 6d 65 6e  75 20 79 6f 75 20 63 61  |rent menu you ca|
00003230  6e 20 75 73 65 20 4d 65  6e 75 55 74 69 6c 5f 44  |n use MenuUtil_D|
00003240  65 63 6f 64 65 29 2e 0a  0a 52 31 20 6f 6e 20 65  |ecode)...R1 on e|
00003250  6e 74 72 79 20 6d 75 73  74 20 70 6f 69 6e 74 20  |ntry must point |
00003260  74 6f 20 6d 65 73 73 61  67 65 20 62 6c 6f 63 6b  |to message block|
00003270  20 28 69 6e 20 66 61 63  74 20 6f 6e 6c 79 20 74  | (in fact only t|
00003280  77 6f 20 77 6f 72 64 73  20 61 74 20 6f 66 66 73  |wo words at offs|
00003290  65 74 73 0a 2b 32 34 20  61 6e 64 20 2b 32 38 20  |ets.+24 and +28 |
000032a0  77 69 6c 6c 20 62 65 20  75 73 65 64 29 2e 0a 20  |will be used).. |
000032b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000032c0  0a 4e 6f 74 65 3a 20 49  66 20 79 6f 75 20 70 6c  |.Note: If you pl|
000032d0  61 6e 20 74 6f 20 75 73  65 20 4d 65 6e 75 55 74  |an to use MenuUt|
000032e0  69 6c 5f 44 65 63 6f 64  65 20 74 68 65 6e 20 61  |il_Decode then a|
000032f0  6c 6c 20 73 75 62 6d 65  6e 75 20 70 6f 69 6e 74  |ll submenu point|
00003300  65 72 73 20 6d 75 73 74  20 62 65 0a 76 61 6c 69  |ers must be.vali|
00003310  64 2e 20 49 74 20 6d 65  61 6e 73 20 74 68 61 74  |d. It means that|
00003320  20 79 6f 75 20 68 61 76  65 20 74 6f 20 6c 69 6e  | you have to lin|
00003330  6b 20 73 75 62 6d 65 6e  75 20 70 6f 69 6e 74 65  |k submenu pointe|
00003340  64 20 74 6f 20 62 79 20  52 30 20 77 69 74 68 0a  |d to by R0 with.|
00003350  63 6f 72 72 65 73 70 6f  6e 64 69 6e 67 20 6d 65  |corresponding me|
00003360  6e 75 20 69 74 65 6d 2e  20 54 68 69 73 20 63 61  |nu item. This ca|
00003370  6e 20 62 65 20 64 6f 6e  65 20 62 79 20 4d 65 6e  |n be done by Men|
00003380  75 55 74 69 6c 5f 53 75  62 4d 65 6e 75 2e 0a 0a  |uUtil_SubMenu...|
00003390  20 45 78 61 6d 70 6c 65  20 63 6f 64 65 3a 0a 20  | Example code:. |
000033a0  44 69 73 70 6c 61 79 20  66 6f 6e 74 73 20 73 75  |Display fonts su|
000033b0  62 6d 65 6e 75 20 6f 6e  20 73 63 72 65 65 6e 20  |bmenu on screen |
000033c0  61 66 74 65 72 20 72 65  63 65 69 76 69 6e 67 20  |after receiving |
000033d0  4d 65 6e 75 57 61 72 6e  69 6e 67 3a 0a 20 53 59  |MenuWarning:. SY|
000033e0  53 20 22 4d 65 6e 75 55  74 69 6c 5f 53 75 62 4d  |S "MenuUtil_SubM|
000033f0  65 6e 75 22 2c 66 6f 6e  74 73 49 74 65 6d 25 2c  |enu",fontsItem%,|
00003400  66 6f 6e 74 73 4d 65 6e  75 25 0a 20 53 59 53 20  |fontsMenu%. SYS |
00003410  22 4d 65 6e 75 55 74 69  6c 5f 53 68 6f 77 53 75  |"MenuUtil_ShowSu|
00003420  62 4d 65 6e 75 22 2c 66  6f 6e 74 73 4d 65 6e 75  |bMenu",fontsMenu|
00003430  25 2c 71 25 0a 20 0a 0a  0a 0a 0a 20 4d 65 6e 75  |%,q%. ..... Menu|
00003440  55 74 69 6c 5f 49 6e 66  6f 20 28 53 57 49 20 26  |Util_Info (SWI &|
00003450  34 35 42 43 37 29 0a 20  2d 2d 2d 2d 2d 2d 2d 2d  |45BC7). --------|
00003460  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00003470  2d 2d 0a 54 68 69 73 20  63 61 6c 6c 20 72 65 74  |--.This call ret|
00003480  75 72 6e 73 20 76 61 72  69 6f 75 73 20 69 6e 66  |urns various inf|
00003490  6f 72 6d 61 74 69 6f 6e  20 61 62 6f 75 74 20 74  |ormation about t|
000034a0  68 65 20 77 68 6f 6c 65  20 6d 65 6e 75 20 6f 72  |he whole menu or|
000034b0  20 61 62 6f 75 74 20 74  68 65 0a 70 61 72 74 69  | about the.parti|
000034c0  63 75 6c 61 72 20 6d 65  6e 75 20 69 74 65 6d 2e  |cular menu item.|
000034d0  0a 0a 20 45 6e 74 72 79  3a 0a 20 20 20 20 20 52  |.. Entry:.     R|
000034e0  30 20 3d 20 68 61 6e 64  6c 65 20 6f 66 20 74 68  |0 = handle of th|
000034f0  65 20 6d 65 6e 75 20 6f  72 20 6f 66 20 74 68 65  |e menu or of the|
00003500  20 6d 65 6e 75 20 69 74  65 6d 20 6f 72 20 7a 65  | menu item or ze|
00003510  72 6f 20 66 6f 72 20 63  75 72 72 65 6e 74 20 69  |ro for current i|
00003520  74 65 6d 0a 20 45 78 69  74 3a 0a 20 20 20 20 20  |tem. Exit:.     |
00003530  52 30 20 2d 3e 20 70 6f  69 6e 74 65 72 20 74 6f  |R0 -> pointer to|
00003540  20 62 6c 6f 63 6b 0a 0a  52 65 74 75 72 6e 65 64  | block..Returned|
00003550  20 62 6c 6f 63 6b 20 63  6f 6e 74 61 69 6e 73 20  | block contains |
00003560  74 68 65 20 66 6f 6c 6c  6f 77 69 6e 67 20 69 6e  |the following in|
00003570  66 6f 72 6d 61 74 69 6f  6e 3a 0a 20 20 20 52 30  |formation:.   R0|
00003580  20 2b 20 30 20 70 6f 69  6e 74 65 72 20 74 6f 20  | + 0 pointer to |
00003590  6d 65 6e 75 20 64 61 74  61 20 73 74 72 75 63 74  |menu data struct|
000035a0  75 72 65 0a 20 20 20 52  30 20 2b 20 34 20 70 6f  |ure.   R0 + 4 po|
000035b0  69 6e 74 65 72 20 74 6f  20 69 74 65 6d 20 64 61  |inter to item da|
000035c0  74 61 20 6f 72 20 7a 65  72 6f 0a 0a 4d 65 6e 75  |ta or zero..Menu|
000035d0  73 20 63 72 65 61 74 65  64 20 77 69 74 68 20 4d  |s created with M|
000035e0  65 6e 75 55 74 69 6c 73  20 61 72 65 20 6e 6f 74  |enuUtils are not|
000035f0  20 73 74 61 74 69 63 20  61 6e 64 20 6d 61 79 20  | static and may |
00003600  62 65 20 6d 6f 76 65 64  20 69 6e 0a 6d 65 6d 6f  |be moved in.memo|
00003610  72 79 2c 20 66 6f 72 20  65 78 61 6d 70 6c 65 20  |ry, for example |
00003620  61 66 74 65 72 20 61 64  64 69 6e 67 20 6e 65 77  |after adding new|
00003630  20 69 74 65 6d 73 2e 20  53 6f 20 79 6f 75 20 6d  | items. So you m|
00003640  75 73 74 20 75 73 65 20  64 69 72 65 63 74 0a 70  |ust use direct.p|
00003650  6f 69 6e 74 65 72 73 20  74 6f 20 74 68 69 73 20  |ointers to this |
00003660  6d 65 6e 75 73 20 77 69  74 68 20 63 61 75 74 69  |menus with cauti|
00003670  6f 6e 20 75 6e 74 69 6c  20 79 6f 75 20 68 61 76  |on until you hav|
00003680  65 20 63 6f 6d 70 6c 65  74 65 6c 79 20 66 69 6e  |e completely fin|
00003690  69 73 68 65 64 0a 74 68  65 20 6d 65 6e 75 20 63  |ished.the menu c|
000036a0  6f 6e 73 74 72 75 63 74  69 6f 6e 2e 0a 0a 0a 0a  |onstruction.....|
000036b0  0a 20 4d 65 6e 75 55 74  69 6c 5f 54 65 78 74 20  |. MenuUtil_Text |
000036c0  28 53 57 49 20 26 34 35  42 43 38 29 0a 20 2d 2d  |(SWI &45BC8). --|
000036d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000036e0  2d 2d 2d 2d 2d 2d 2d 2d  0a 20 43 68 61 6e 67 65  |--------. Change|
000036f0  73 20 6d 65 6e 75 20 74  69 74 6c 65 20 73 74 72  |s menu title str|
00003700  69 6e 67 20 6f 72 20 74  65 78 74 20 6f 66 20 6d  |ing or text of m|
00003710  65 6e 75 20 69 74 65 6d  0a 0a 20 45 6e 74 72 79  |enu item.. Entry|
00003720  3a 0a 20 20 20 20 20 52  30 20 3d 20 68 61 6e 64  |:.     R0 = hand|
00003730  6c 65 20 6f 66 20 6d 65  6e 75 20 69 74 65 6d 20  |le of menu item |
00003740  6f 72 20 68 61 6e 64 6c  65 20 6f 66 20 6d 65 6e  |or handle of men|
00003750  75 20 6f 72 20 20 7a 65  72 6f 20 66 6f 72 20 63  |u or  zero for c|
00003760  75 72 72 65 6e 74 20 69  74 65 6d 0a 20 20 20 20  |urrent item.    |
00003770  20 52 31 20 2d 3e 20 70  6f 69 6e 74 65 72 20 74  | R1 -> pointer t|
00003780  6f 20 74 65 78 74 20 73  74 72 69 6e 67 20 0a 20  |o text string . |
00003790  45 78 69 74 3a 0a 20 20  20 20 20 52 30 2c 52 31  |Exit:.     R0,R1|
000037a0  20 70 72 65 73 65 72 76  65 64 0a 20 0a 54 68 69  | preserved. .Thi|
000037b0  73 20 63 61 6c 6c 20 61  6c 6c 6f 77 73 20 79 6f  |s call allows yo|
000037c0  75 20 74 6f 20 63 68 61  6e 67 65 20 74 69 74 6c  |u to change titl|
000037d0  65 20 73 74 72 69 6e 67  20 6f 66 20 6d 65 6e 75  |e string of menu|
000037e0  20 6f 72 20 74 65 78 74  20 6f 66 20 6d 65 6e 75  | or text of menu|
000037f0  20 69 74 65 6d 2e 0a 54  68 65 20 73 74 72 75 63  | item..The struc|
00003800  74 75 72 65 20 6f 66 20  6d 65 6e 75 20 74 72 65  |ture of menu tre|
00003810  65 20 72 65 6d 61 69 6e  73 20 75 6e 63 68 61 6e  |e remains unchan|
00003820  67 65 64 20 62 75 74 20  70 6f 69 6e 74 65 72 20  |ged but pointer |
00003830  74 6f 20 69 74 65 6d 20  74 65 78 74 20 6d 61 79  |to item text may|
00003840  20 62 65 0a 63 68 61 6e  67 65 64 2e 20 54 68 65  | be.changed. The|
00003850  20 68 61 6e 64 6c 65 20  6f 66 20 74 68 65 20 6d  | handle of the m|
00003860  65 6e 75 20 6f 72 20 6d  65 6e 75 20 69 74 65 6d  |enu or menu item|
00003870  20 6d 75 73 74 20 62 65  20 73 70 65 63 69 66 69  | must be specifi|
00003880  65 64 20 69 6e 20 52 30  2e 20 49 66 20 52 30 0a  |ed in R0. If R0.|
00003890  69 73 20 7a 65 72 6f 20  6f 6e 20 65 6e 74 72 79  |is zero on entry|
000038a0  20 74 68 65 6e 20 74 68  65 20 74 65 78 74 20 6f  | then the text o|
000038b0  66 20 63 75 72 72 65 6e  74 20 69 74 65 6d 20 77  |f current item w|
000038c0  69 6c 6c 20 62 65 20 63  68 61 6e 67 65 64 2e 20  |ill be changed. |
000038d0  52 31 20 6d 75 73 74 0a  70 6f 69 6e 74 20 74 6f  |R1 must.point to|
000038e0  20 74 68 65 20 63 74 72  6c 2d 74 65 72 6d 69 6e  | the ctrl-termin|
000038f0  61 74 65 64 20 74 65 78  74 20 73 74 72 69 6e 67  |ated text string|
00003900  2e 20 49 66 20 52 31 20  69 73 20 7a 65 72 6f 20  |. If R1 is zero |
00003910  6f 6e 20 65 6e 74 72 79  20 74 68 65 6e 20 6e 75  |on entry then nu|
00003920  6c 6c 0a 73 74 72 69 6e  67 20 77 69 6c 6c 20 62  |ll.string will b|
00003930  65 20 75 73 65 64 2e 20  52 65 6d 65 6d 62 65 72  |e used. Remember|
00003940  20 74 68 61 74 20 74 68  65 20 6c 65 6e 67 74 68  | that the length|
00003950  20 6f 66 20 6d 65 6e 75  20 74 69 74 6c 65 20 69  | of menu title i|
00003960  73 20 6c 69 6d 69 74 65  64 20 62 79 20 31 32 0a  |s limited by 12.|
00003970  73 79 6d 62 6f 6c 73 2e  0a 0a 20 45 78 61 6d 70  |symbols... Examp|
00003980  6c 65 20 63 6f 64 65 20  0a 20 53 65 74 20 6e 65  |le code . Set ne|
00003990  77 20 6d 65 6e 75 20 74  69 74 6c 65 20 73 74 72  |w menu title str|
000039a0  69 6e 67 3a 0a 20 53 59  53 20 22 4d 65 6e 75 55  |ing:. SYS "MenuU|
000039b0  74 69 6c 5f 54 65 78 74  22 2c 6f 62 6a 65 63 74  |til_Text",object|
000039c0  4d 65 6e 75 25 2c 22 44  69 72 65 63 74 6f 72 79  |Menu%,"Directory|
000039d0  22 0a 0a 20 4c 65 74 27  73 20 76 61 72 69 61 62  |".. Let's variab|
000039e0  6c 65 20 74 79 70 65 25  20 63 6f 6e 74 61 69 6e  |le type% contain|
000039f0  73 20 6f 6e 65 20 6f 66  20 74 68 65 20 76 61 6c  |s one of the val|
00003a00  75 65 73 20 30 2c 31 2c  32 20 6f 72 20 33 20 64  |ues 0,1,2 or 3 d|
00003a10  65 70 65 6e 64 69 6e 67  20 6f 6e 20 74 68 65 0a  |epending on the.|
00003a20  6f 62 6a 65 63 74 20 73  65 6c 65 63 74 65 64 20  |object selected |
00003a30  69 6e 20 46 69 6c 65 72  20 77 69 6e 64 6f 77 20  |in Filer window |
00003a40  61 6e 64 20 76 61 72 69  61 62 6c 65 20 6e 61 6d  |and variable nam|
00003a50  65 24 20 63 6f 6e 74 61  69 6e 73 20 74 68 65 20  |e$ contains the |
00003a60  6e 61 6d 65 20 6f 66 20  74 68 65 0a 66 69 6c 65  |name of the.file|
00003a70  20 6f 72 20 64 69 72 65  63 74 6f 72 79 20 73 65  | or directory se|
00003a80  6c 65 63 74 65 64 2e 20  20 0a 0a 43 41 53 45 20  |lected.  ..CASE |
00003a90  74 79 70 65 25 20 4f 46  0a 20 20 57 48 45 4e 20  |type% OF.  WHEN |
00003aa0  30 3a 69 24 3d 22 46 69  6c 65 20 27 27 22 0a 20  |0:i$="File ''". |
00003ab0  20 57 48 45 4e 20 31 3a  69 24 3d 22 46 69 6c 65  | WHEN 1:i$="File|
00003ac0  20 27 22 2b 6e 61 6d 65  24 2b 22 27 22 3a 73 24  | '"+name$+"'":s$|
00003ad0  3d 22 46 69 6c 65 22 0a  20 20 57 48 45 4e 20 32  |="File".  WHEN 2|
00003ae0  3a 69 24 3d 22 44 69 72  2e 20 27 22 2b 6e 61 6d  |:i$="Dir. '"+nam|
00003af0  65 24 2b 22 27 22 3a 73  24 3d 22 44 69 72 65 63  |e$+"'":s$="Direc|
00003b00  74 6f 72 79 22 0a 20 20  57 48 45 4e 20 33 3a 69  |tory".  WHEN 3:i|
00003b10  24 3d 22 53 65 6c 65 63  74 69 6f 6e 22 3a 73 24  |$="Selection":s$|
00003b20  3d 69 24 0a 45 4e 44 43  41 53 45 0a 20 20 20 20  |=i$.ENDCASE.    |
00003b30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 0a  |               .|
00003b40  52 45 4d 20 66 61 64 65  20 74 68 65 20 69 74 65  |REM fade the ite|
00003b50  6d 20 69 66 20 6e 6f 74  68 69 6e 67 20 69 73 20  |m if nothing is |
00003b60  73 65 6c 65 63 74 65 64  0a 53 59 53 20 22 4d 65  |selected.SYS "Me|
00003b70  6e 75 55 74 69 6c 5f 46  61 64 65 22 2c 6f 62 6a  |nuUtil_Fade",obj|
00003b80  65 63 74 49 74 65 6d 25  2c 74 79 70 65 25 3d 30  |ectItem%,type%=0|
00003b90  20 20 20 20 20 20 20 20  20 20 20 0a 0a 52 45 4d  |           ..REM|
00003ba0  20 73 65 74 20 6e 65 77  20 69 74 65 6d 20 74 65  | set new item te|
00003bb0  78 74 0a 53 59 53 20 22  4d 65 6e 75 55 74 69 6c  |xt.SYS "MenuUtil|
00003bc0  5f 54 65 78 74 22 2c 2c  69 24 0a 20 20 20 20 20  |_Text",,i$.     |
00003bd0  20 20 20 20 20 20 0a 52  45 4d 20 73 65 74 20 6e  |      .REM set n|
00003be0  65 77 20 73 75 62 6d 65  6e 75 20 74 69 74 6c 65  |ew submenu title|
00003bf0  0a 53 59 53 20 22 4d 65  6e 75 55 74 69 6c 5f 54  |.SYS "MenuUtil_T|
00003c00  65 78 74 22 2c 74 6f 6f  6c 73 4d 65 6e 75 25 2c  |ext",toolsMenu%,|
00003c10  73 24 0a 0a 0a 0a 0a 20  4d 65 6e 75 55 74 69 6c  |s$..... MenuUtil|
00003c20  5f 54 69 63 6b 20 28 53  57 49 20 26 34 35 42 43  |_Tick (SWI &45BC|
00003c30  39 29 0a 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |9). ------------|
00003c40  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 20 20  |--------------  |
00003c50  20 20 20 20 20 20 20 20  20 20 0a 54 68 69 73 20  |          .This |
00003c60  63 61 6c 6c 20 6d 61 79  20 62 65 20 75 73 65 64  |call may be used|
00003c70  20 74 6f 20 6d 6f 64 69  66 79 20 74 68 65 20 73  | to modify the s|
00003c80  74 61 74 65 20 6f 66 20  6d 65 6e 75 20 66 6c 61  |tate of menu fla|
00003c90  67 20 77 68 69 63 68 20  63 6f 6e 74 72 6f 6c 73  |g which controls|
00003ca0  0a 74 68 65 20 74 69 63  6b 20 64 69 73 70 6c 61  |.the tick displa|
00003cb0  79 65 64 20 6f 6e 20 74  68 65 20 6c 65 66 74 20  |yed on the left |
00003cc0  6f 66 20 74 68 65 20 6d  65 6e 75 20 69 74 65 6d  |of the menu item|
00003cd0  2e 20 0a 0a 20 45 6e 74  72 79 3a 0a 20 20 20 20  |. .. Entry:.    |
00003ce0  20 52 30 20 68 61 6e 64  6c 65 20 6f 66 20 6d 65  | R0 handle of me|
00003cf0  6e 75 20 69 74 65 6d 20  6f 72 20 7a 65 72 6f 20  |nu item or zero |
00003d00  66 6f 72 20 63 75 72 72  65 6e 74 20 6d 65 6e 75  |for current menu|
00003d10  20 69 74 65 6d 20 6f 72  20 68 61 6e 64 6c 65 20  | item or handle |
00003d20  6f 66 20 6d 65 6e 75 0a  20 20 20 20 20 52 31 20  |of menu.     R1 |
00003d30  64 65 66 69 6e 65 73 20  61 63 74 69 6f 6e 0a 20  |defines action. |
00003d40  20 20 20 20 20 20 20 69  66 20 52 31 20 3d 30 20  |       if R1 =0 |
00003d50  74 68 65 6e 20 63 6c 65  61 72 20 74 69 63 6b 20  |then clear tick |
00003d60  66 6c 61 67 20 0a 20 20  20 20 20 20 20 20 69 66  |flag .        if|
00003d70  20 52 31 20 3c 3e 30 20  74 68 65 6e 20 73 65 74  | R1 <>0 then set|
00003d80  20 74 69 63 6b 20 66 6c  61 67 20 20 0a 20 45 78  | tick flag  . Ex|
00003d90  69 74 3a 0a 20 20 20 20  52 30 2c 52 31 20 70 72  |it:.    R0,R1 pr|
00003da0  65 73 65 72 76 65 64 0a  20 20 20 20 20 20 20 20  |eserved.        |
00003db0  20 20 20 20 0a 52 30 20  6d 75 73 74 20 63 6f 6e  |    .R0 must con|
00003dc0  74 61 69 6e 20 74 68 65  20 69 74 65 6d 20 68 61  |tain the item ha|
00003dd0  6e 64 6c 65 20 6f 72 20  7a 65 72 6f 20 66 6f 72  |ndle or zero for|
00003de0  20 74 68 65 20 63 75 72  72 65 6e 74 20 6d 65 6e  | the current men|
00003df0  75 20 69 74 65 6d 2e 20  52 31 0a 64 65 66 69 6e  |u item. R1.defin|
00003e00  65 73 20 74 6f 20 73 65  74 20 6f 72 20 74 6f 20  |es to set or to |
00003e10  63 6c 65 61 72 20 74 68  65 20 66 6c 61 67 2e 20  |clear the flag. |
00003e20  49 66 20 52 31 20 69 73  20 7a 65 72 6f 20 74 68  |If R1 is zero th|
00003e30  65 6e 20 74 68 65 20 66  6c 61 67 20 77 69 6c 6c  |en the flag will|
00003e40  0a 62 65 20 63 6c 65 61  72 65 64 20 61 6e 64 20  |.be cleared and |
00003e50  69 66 20 52 31 20 69 73  20 6e 6f 6e 20 7a 65 72  |if R1 is non zer|
00003e60  6f 20 74 68 65 6e 20 74  68 65 20 66 6c 61 67 20  |o then the flag |
00003e70  77 69 6c 6c 20 62 65 20  73 65 74 2e 0a 0a 49 66  |will be set...If|
00003e80  20 52 30 20 69 6e 73 74  65 61 64 20 6f 66 20 69  | R0 instead of i|
00003e90  74 65 6d 20 68 61 6e 64  6c 65 20 63 6f 6e 74 61  |tem handle conta|
00003ea0  69 6e 73 20 6d 65 6e 75  20 68 61 6e 64 6c 65 20  |ins menu handle |
00003eb0  74 68 65 6e 20 74 68 65  20 73 74 61 74 65 20 6f  |then the state o|
00003ec0  66 0a 74 68 65 20 66 6c  61 67 20 77 69 6c 6c 20  |f.the flag will |
00003ed0  62 65 20 63 68 61 6e 67  65 64 20 69 6e 20 61 6c  |be changed in al|
00003ee0  6c 20 69 74 65 6d 73 20  6f 66 20 74 68 69 73 20  |l items of this |
00003ef0  6d 65 6e 75 2e 0a 0a 49  74 20 69 73 20 63 6f 6e  |menu...It is con|
00003f00  76 65 6e 69 65 6e 74 20  74 6f 20 70 61 73 73 20  |venient to pass |
00003f10  69 6e 20 52 31 20 74 68  65 20 72 65 73 75 6c 74  |in R1 the result|
00003f20  20 6f 66 20 6c 6f 67 69  63 61 6c 20 65 78 70 72  | of logical expr|
00003f30  65 73 73 69 6f 6e 20 28  74 6f 0a 73 65 74 20 66  |ession (to.set f|
00003f40  6c 61 67 20 69 66 20 72  65 73 75 6c 74 20 69 73  |lag if result is|
00003f50  20 54 52 55 45 20 61 6e  64 20 74 6f 20 63 6c 65  | TRUE and to cle|
00003f60  61 72 20 69 74 20 69 66  20 46 41 4c 53 45 29 2e  |ar it if FALSE).|
00003f70  0a 0a 20 45 78 61 6d 70  6c 65 20 63 6f 64 65 3a  |.. Example code:|
00003f80  0a 20 54 69 63 6b 20 6f  6e 65 20 6f 66 20 74 68  |. Tick one of th|
00003f90  65 20 69 74 65 6d 73 20  64 65 70 65 6e 64 69 6e  |e items dependin|
00003fa0  67 20 6f 6e 20 74 68 65  20 76 61 6c 75 65 20 6f  |g on the value o|
00003fb0  66 20 76 61 72 69 61 62  6c 65 20 64 69 73 70 25  |f variable disp%|
00003fc0  3a 0a 20 53 59 53 20 22  4d 65 6e 75 55 74 69 6c  |:. SYS "MenuUtil|
00003fd0  5f 54 69 63 6b 22 2c 6c  61 72 67 65 49 74 65 6d  |_Tick",largeItem|
00003fe0  25 2c 28 64 69 73 70 25  3d 31 29 0a 20 53 59 53  |%,(disp%=1). SYS|
00003ff0  20 22 4d 65 6e 75 55 74  69 6c 5f 54 69 63 6b 22  | "MenuUtil_Tick"|
00004000  2c 73 6d 61 6c 6c 49 74  65 6d 2c 28 64 69 73 70  |,smallItem,(disp|
00004010  25 3d 32 29 0a 20 53 59  53 20 22 4d 65 6e 75 55  |%=2). SYS "MenuU|
00004020  74 69 6c 5f 54 69 63 6b  22 2c 66 75 6c 6c 49 74  |til_Tick",fullIt|
00004030  65 6d 25 2c 28 64 69 73  70 25 3d 33 29 0a 20 20  |em%,(disp%=3).  |
00004040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004060  20 20 20 20 20 20 20 20  20 0a 0a 0a 0a 20 4d 65  |         .... Me|
00004070  6e 75 55 74 69 6c 5f 44  6f 74 73 20 28 53 57 49  |nuUtil_Dots (SWI|
00004080  20 20 26 34 35 42 43 41  29 0a 20 2d 2d 2d 2d 2d  |  &45BCA). -----|
00004090  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000040a0  2d 2d 2d 2d 2d 2d 20 20  20 20 20 20 20 20 20 20  |------          |
000040b0  20 20 0a 54 68 69 73 20  63 61 6c 6c 20 6d 61 79  |  .This call may|
000040c0  20 62 65 20 75 73 65 64  20 74 6f 20 6d 6f 64 69  | be used to modi|
000040d0  66 79 20 74 68 65 20 73  74 61 74 65 20 6f 66 20  |fy the state of |
000040e0  6d 65 6e 75 20 66 6c 61  67 20 77 68 69 63 68 20  |menu flag which |
000040f0  63 6f 6e 74 72 6f 6c 73  0a 74 68 65 20 64 6f 74  |controls.the dot|
00004100  74 65 64 20 6c 69 6e 65  20 64 69 73 70 6c 61 79  |ted line display|
00004110  65 64 20 62 65 6c 6c 6f  77 20 74 68 65 20 6d 65  |ed bellow the me|
00004120  6e 75 20 69 74 65 6d 2e  20 0a 0a 20 45 6e 74 72  |nu item. .. Entr|
00004130  79 3a 0a 20 20 20 20 20  52 30 20 68 61 6e 64 6c  |y:.     R0 handl|
00004140  65 20 6f 66 20 6d 65 6e  75 20 69 74 65 6d 20 6f  |e of menu item o|
00004150  72 20 7a 65 72 6f 20 66  6f 72 20 63 75 72 72 65  |r zero for curre|
00004160  6e 74 20 6d 65 6e 75 20  69 74 65 6d 20 6f 72 20  |nt menu item or |
00004170  68 61 6e 64 6c 65 20 6f  66 20 6d 65 6e 75 0a 20  |handle of menu. |
00004180  20 20 20 20 52 31 20 64  65 66 69 6e 65 73 20 61  |    R1 defines a|
00004190  63 74 69 6f 6e 0a 20 20  20 20 20 20 20 20 69 66  |ction.        if|
000041a0  20 52 31 20 3d 30 20 74  68 65 6e 20 63 6c 65 61  | R1 =0 then clea|
000041b0  72 20 64 6f 74 73 20 66  6c 61 67 20 0a 20 20 20  |r dots flag .   |
000041c0  20 20 20 20 20 69 66 20  52 31 20 3c 3e 30 20 74  |     if R1 <>0 t|
000041d0  68 65 6e 20 73 65 74 20  64 6f 74 73 20 66 6c 61  |hen set dots fla|
000041e0  67 20 20 0a 20 45 78 69  74 3a 0a 20 20 20 20 52  |g  . Exit:.    R|
000041f0  30 2c 52 31 20 70 72 65  73 65 72 76 65 64 0a 20  |0,R1 preserved. |
00004200  20 20 20 20 20 20 20 20  20 20 20 0a 52 30 20 6d  |           .R0 m|
00004210  75 73 74 20 63 6f 6e 74  61 69 6e 20 74 68 65 20  |ust contain the |
00004220  69 74 65 6d 20 68 61 6e  64 6c 65 20 6f 72 20 7a  |item handle or z|
00004230  65 72 6f 20 66 6f 72 20  74 68 65 20 63 75 72 72  |ero for the curr|
00004240  65 6e 74 20 6d 65 6e 75  20 69 74 65 6d 2e 20 52  |ent menu item. R|
00004250  31 0a 64 65 66 69 6e 65  73 20 74 6f 20 73 65 74  |1.defines to set|
00004260  20 6f 72 20 74 6f 20 63  6c 65 61 72 20 74 68 65  | or to clear the|
00004270  20 66 6c 61 67 2e 20 49  66 20 52 31 20 69 73 20  | flag. If R1 is |
00004280  7a 65 72 6f 20 74 68 65  6e 20 74 68 65 20 66 6c  |zero then the fl|
00004290  61 67 20 77 69 6c 6c 0a  62 65 20 63 6c 65 61 72  |ag will.be clear|
000042a0  65 64 20 61 6e 64 20 69  66 20 52 31 20 69 73 20  |ed and if R1 is |
000042b0  6e 6f 6e 20 7a 65 72 6f  20 74 68 65 6e 20 74 68  |non zero then th|
000042c0  65 20 66 6c 61 67 20 77  69 6c 6c 20 62 65 20 73  |e flag will be s|
000042d0  65 74 2e 0a 0a 49 66 20  52 30 20 69 6e 73 74 65  |et...If R0 inste|
000042e0  61 64 20 6f 66 20 69 74  65 6d 20 68 61 6e 64 6c  |ad of item handl|
000042f0  65 20 63 6f 6e 74 61 69  6e 73 20 6d 65 6e 75 20  |e contains menu |
00004300  68 61 6e 64 6c 65 20 74  68 65 6e 20 74 68 65 20  |handle then the |
00004310  73 74 61 74 65 20 6f 66  0a 74 68 65 20 66 6c 61  |state of.the fla|
00004320  67 20 77 69 6c 6c 20 62  65 20 63 68 61 6e 67 65  |g will be change|
00004330  64 20 69 6e 20 61 6c 6c  20 69 74 65 6d 73 20 6f  |d in all items o|
00004340  66 20 74 68 69 73 20 6d  65 6e 75 2e 0a 0a 49 74  |f this menu...It|
00004350  20 69 73 20 63 6f 6e 76  65 6e 69 65 6e 74 20 74  | is convenient t|
00004360  6f 20 70 61 73 73 20 69  6e 20 52 31 20 74 68 65  |o pass in R1 the|
00004370  20 72 65 73 75 6c 74 20  6f 66 20 6c 6f 67 69 63  | result of logic|
00004380  61 6c 20 65 78 70 72 65  73 73 69 6f 6e 20 28 74  |al expression (t|
00004390  6f 0a 73 65 74 20 66 6c  61 67 20 69 66 20 72 65  |o.set flag if re|
000043a0  73 75 6c 74 20 69 73 20  54 52 55 45 20 61 6e 64  |sult is TRUE and|
000043b0  20 74 6f 20 63 6c 65 61  72 20 69 74 20 69 66 20  | to clear it if |
000043c0  46 41 4c 53 45 29 2e 0a  0a 20 45 78 61 6d 70 6c  |FALSE)... Exampl|
000043d0  65 20 63 6f 64 65 3a 0a  20 44 69 73 70 6c 61 79  |e code:. Display|
000043e0  20 64 6f 74 74 65 64 20  6c 69 6e 65 20 61 66 74  | dotted line aft|
000043f0  65 72 20 74 68 65 20 63  75 72 72 65 6e 74 20 6d  |er the current m|
00004400  65 6e 75 20 69 74 65 6d  0a 20 53 59 53 20 22 4d  |enu item. SYS "M|
00004410  65 6e 75 55 74 69 6c 5f  44 6f 74 73 22 2c 2c 54  |enuUtil_Dots",,T|
00004420  52 55 45 0a 20 0a 20 20  20 20 20 20 20 20 20 20  |RUE. .          |
00004430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004450  20 0a 0a 20 4d 65 6e 75  55 74 69 6c 5f 46 61 64  | .. MenuUtil_Fad|
00004460  65 20 28 26 34 35 42 43  42 29 0a 20 2d 2d 2d 2d  |e (&45BCB). ----|
00004470  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004480  2d 2d 20 20 20 20 20 20  20 20 20 20 20 20 0a 54  |--            .T|
00004490  68 69 73 20 63 61 6c 6c  20 63 61 6e 20 62 65 20  |his call can be |
000044a0  75 73 65 64 20 74 6f 20  6d 61 6b 65 20 6d 65 6e  |used to make men|
000044b0  75 20 69 74 65 6d 20 6e  6f 6e 2d 70 69 63 6b 61  |u item non-picka|
000044c0  62 6c 65 20 0a 0a 20 45  6e 74 72 79 3a 0a 20 20  |ble .. Entry:.  |
000044d0  20 20 20 52 30 20 68 61  6e 64 6c 65 20 6f 66 20  |   R0 handle of |
000044e0  6d 65 6e 75 20 69 74 65  6d 20 6f 72 20 7a 65 72  |menu item or zer|
000044f0  6f 20 66 6f 72 20 63 75  72 72 65 6e 74 20 6d 65  |o for current me|
00004500  6e 75 20 69 74 65 6d 20  6f 72 20 68 61 6e 64 6c  |nu item or handl|
00004510  65 20 6f 66 20 6d 65 6e  75 0a 20 20 20 20 20 52  |e of menu.     R|
00004520  31 20 64 65 66 69 6e 65  73 20 61 63 74 69 6f 6e  |1 defines action|
00004530  0a 20 20 20 20 20 20 20  20 69 66 20 52 31 20 3d  |.        if R1 =|
00004540  30 20 63 6c 65 61 72 20  73 68 61 64 65 64 20 6d  |0 clear shaded m|
00004550  65 6e 75 20 66 6c 61 67  0a 20 20 20 20 20 20 20  |enu flag.       |
00004560  20 69 66 20 52 31 20 3c  3e 30 20 66 61 64 65 20  | if R1 <>0 fade |
00004570  74 68 69 73 20 6d 65 6e  75 20 69 74 65 6d 20 28  |this menu item (|
00004580  69 65 2e 20 75 6e 70 69  63 6b 61 62 6c 65 29 20  |ie. unpickable) |
00004590  0a 20 45 78 69 74 3a 0a  20 20 20 20 52 30 2c 52  |. Exit:.    R0,R|
000045a0  31 20 70 72 65 73 65 72  76 65 64 0a 20 20 20 20  |1 preserved.    |
000045b0  20 20 20 20 20 20 20 20  0a 52 30 20 6d 75 73 74  |        .R0 must|
000045c0  20 63 6f 6e 74 61 69 6e  20 74 68 65 20 69 74 65  | contain the ite|
000045d0  6d 20 68 61 6e 64 6c 65  20 6f 72 20 7a 65 72 6f  |m handle or zero|
000045e0  20 66 6f 72 20 74 68 65  20 63 75 72 72 65 6e 74  | for the current|
000045f0  20 6d 65 6e 75 20 69 74  65 6d 2e 20 52 31 0a 64  | menu item. R1.d|
00004600  65 66 69 6e 65 73 20 74  6f 20 73 65 74 20 6f 72  |efines to set or|
00004610  20 74 6f 20 63 6c 65 61  72 20 74 68 65 20 66 6c  | to clear the fl|
00004620  61 67 20 77 68 69 63 68  20 6d 61 6b 65 73 20 6d  |ag which makes m|
00004630  65 6e 75 20 69 74 65 6d  20 75 6e 70 69 63 6b 61  |enu item unpicka|
00004640  62 6c 65 2e 20 49 66 20  52 31 0a 69 73 20 7a 65  |ble. If R1.is ze|
00004650  72 6f 20 74 68 65 6e 20  74 68 65 20 66 6c 61 67  |ro then the flag|
00004660  20 77 69 6c 6c 20 62 65  20 63 6c 65 61 72 65 64  | will be cleared|
00004670  20 61 6e 64 20 69 66 20  52 31 20 69 73 20 6e 6f  | and if R1 is no|
00004680  6e 20 7a 65 72 6f 20 74  68 65 6e 20 74 68 65 20  |n zero then the |
00004690  66 6c 61 67 0a 77 69 6c  6c 20 62 65 20 73 65 74  |flag.will be set|
000046a0  20 61 6e 64 20 74 68 65  20 69 74 65 6d 20 77 69  | and the item wi|
000046b0  6c 6c 20 62 65 20 73 68  61 64 65 64 2e 0a 0a 49  |ll be shaded...I|
000046c0  66 20 52 30 20 69 6e 73  74 65 61 64 20 6f 66 20  |f R0 instead of |
000046d0  69 74 65 6d 20 68 61 6e  64 6c 65 20 63 6f 6e 74  |item handle cont|
000046e0  61 69 6e 73 20 6d 65 6e  75 20 68 61 6e 64 6c 65  |ains menu handle|
000046f0  20 74 68 65 6e 20 74 68  65 20 73 74 61 74 65 20  | then the state |
00004700  6f 66 0a 74 68 65 20 66  6c 61 67 20 77 69 6c 6c  |of.the flag will|
00004710  20 62 65 20 63 68 61 6e  67 65 64 20 69 6e 20 61  | be changed in a|
00004720  6c 6c 20 69 74 65 6d 73  20 6f 66 20 74 68 69 73  |ll items of this|
00004730  20 6d 65 6e 75 2e 0a 0a  49 74 20 69 73 20 63 6f  | menu...It is co|
00004740  6e 76 65 6e 69 65 6e 74  20 74 6f 20 70 61 73 73  |nvenient to pass|
00004750  20 69 6e 20 52 31 20 74  68 65 20 72 65 73 75 6c  | in R1 the resul|
00004760  74 20 6f 66 20 6c 6f 67  69 63 61 6c 20 65 78 70  |t of logical exp|
00004770  72 65 73 73 69 6f 6e 20  28 74 6f 0a 73 65 74 20  |ression (to.set |
00004780  66 6c 61 67 20 69 66 20  72 65 73 75 6c 74 20 69  |flag if result i|
00004790  73 20 54 52 55 45 20 61  6e 64 20 74 6f 20 63 6c  |s TRUE and to cl|
000047a0  65 61 72 20 69 74 20 69  66 20 46 41 4c 53 45 29  |ear it if FALSE)|
000047b0  2e 0a 0a 20 45 78 61 6d  70 6c 65 20 63 6f 64 65  |... Example code|
000047c0  3a 0a 20 46 61 64 65 20  63 75 72 72 65 6e 74 20  |:. Fade current |
000047d0  6d 65 6e 75 20 69 74 65  6d 3a 0a 20 53 59 53 20  |menu item:. SYS |
000047e0  22 4d 65 6e 75 55 74 69  6c 5f 46 61 64 65 22 2c  |"MenuUtil_Fade",|
000047f0  2c 54 52 55 45 0a 20 0a  20 46 61 64 65 20 61 6c  |,TRUE. . Fade al|
00004800  6c 20 69 74 65 6d 73 20  69 6e 20 22 53 65 6c 65  |l items in "Sele|
00004810  63 74 22 20 73 75 62 6d  65 6e 75 20 77 69 74 68  |ct" submenu with|
00004820  20 68 61 6e 64 6c 65 20  73 65 6c 63 74 4d 65 6e  | handle selctMen|
00004830  75 25 0a 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |u%. SYS "MenuUti|
00004840  6c 5f 46 61 64 65 22 2c  73 65 6c 65 63 74 4d 65  |l_Fade",selectMe|
00004850  6e 75 25 2c 54 52 55 45  0a 0a 0a 0a 0a 20 4d 65  |nu%,TRUE..... Me|
00004860  6e 75 55 74 69 6c 5f 57  61 72 6e 69 6e 67 20 28  |nuUtil_Warning (|
00004870  53 57 49 20 26 34 35 42  43 43 29 0a 20 2d 2d 2d  |SWI &45BCC). ---|
00004880  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004890  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 20 20 20 20 20 20  |----------      |
000048a0  20 20 20 20 20 20 0a 54  68 69 73 20 63 61 6c 6c  |      .This call|
000048b0  20 63 61 6e 20 62 65 20  75 73 65 64 20 74 6f 20  | can be used to |
000048c0  6d 61 6b 65 20 6d 65 6e  75 20 69 74 65 6d 20 67  |make menu item g|
000048d0  65 6e 65 72 61 74 65 20  61 20 6d 65 73 73 61 67  |enerate a messag|
000048e0  65 20 77 68 65 6e 20 6d  6f 76 69 6e 67 20 74 6f  |e when moving to|
000048f0  0a 74 68 65 20 73 75 62  6d 65 6e 75 20 0a 0a 20  |.the submenu .. |
00004900  45 6e 74 72 79 3a 0a 20  20 20 20 20 52 30 20 68  |Entry:.     R0 h|
00004910  61 6e 64 6c 65 20 6f 66  20 6d 65 6e 75 20 69 74  |andle of menu it|
00004920  65 6d 20 6f 72 20 7a 65  72 6f 20 66 6f 72 20 63  |em or zero for c|
00004930  75 72 72 65 6e 74 20 6d  65 6e 75 20 69 74 65 6d  |urrent menu item|
00004940  20 6f 72 20 68 61 6e 64  6c 65 20 6f 66 20 6d 65  | or handle of me|
00004950  6e 75 0a 20 20 20 20 20  52 31 20 64 65 66 69 6e  |nu.     R1 defin|
00004960  65 73 20 61 63 74 69 6f  6e 0a 20 20 20 20 20 20  |es action.      |
00004970  20 20 69 66 20 52 31 20  3d 30 20 63 6c 65 61 72  |  if R1 =0 clear|
00004980  20 6d 65 73 73 61 67 65  20 6d 65 6e 75 20 66 6c  | message menu fl|
00004990  61 67 0a 20 20 20 20 20  20 20 20 69 66 20 52 31  |ag.        if R1|
000049a0  20 3c 3e 30 20 73 65 74  20 6d 65 73 73 61 67 65  | <>0 set message|
000049b0  20 66 6c 61 67 20 28 69  65 2e 20 6d 65 73 73 61  | flag (ie. messa|
000049c0  67 65 20 77 69 6c 6c 20  62 65 20 67 65 6e 65 72  |ge will be gener|
000049d0  61 74 65 64 29 20 0a 20  45 78 69 74 3a 0a 20 20  |ated) . Exit:.  |
000049e0  20 20 52 30 2c 52 31 20  70 72 65 73 65 72 76 65  |  R0,R1 preserve|
000049f0  64 0a 20 20 20 20 20 20  20 20 20 20 20 20 0a 52  |d.            .R|
00004a00  30 20 6d 75 73 74 20 63  6f 6e 74 61 69 6e 20 74  |0 must contain t|
00004a10  68 65 20 69 74 65 6d 20  68 61 6e 64 6c 65 20 6f  |he item handle o|
00004a20  72 20 7a 65 72 6f 20 66  6f 72 20 74 68 65 20 63  |r zero for the c|
00004a30  75 72 72 65 6e 74 20 6d  65 6e 75 20 69 74 65 6d  |urrent menu item|
00004a40  2e 20 52 31 0a 64 65 66  69 6e 65 73 20 74 6f 20  |. R1.defines to |
00004a50  73 65 74 20 6f 72 20 74  6f 20 63 6c 65 61 72 20  |set or to clear |
00004a60  74 68 65 20 66 6c 61 67  20 77 68 69 63 68 20 63  |the flag which c|
00004a70  68 61 6e 67 65 73 20 73  75 62 6d 65 6e 75 20 62  |hanges submenu b|
00004a80  65 68 61 76 69 6f 75 72  2e 20 49 66 20 52 31 0a  |ehaviour. If R1.|
00004a90  69 73 20 6e 6f 74 20 7a  65 72 6f 2c 20 74 68 65  |is not zero, the|
00004aa0  6e 20 6d 6f 76 69 6e 67  20 6f 76 65 72 20 74 68  |n moving over th|
00004ab0  65 20 72 69 67 68 74 20  61 72 72 6f 77 20 77 69  |e right arrow wi|
00004ac0  6c 6c 20 63 61 75 73 65  20 61 20 4d 65 6e 75 57  |ll cause a MenuW|
00004ad0  61 72 6e 69 6e 67 0a 6d  65 73 73 61 67 65 20 28  |arning.message (|
00004ae0  26 34 30 30 43 30 29 20  74 6f 20 62 65 20 67 65  |&400C0) to be ge|
00004af0  6e 65 72 61 74 65 64 2e  20 54 68 65 20 61 70 70  |nerated. The app|
00004b00  6c 69 63 61 74 69 6f 6e  20 63 61 6e 20 72 65 73  |lication can res|
00004b10  70 6f 6e 64 20 62 79 20  63 61 6c 6c 69 6e 67 0a  |pond by calling.|
00004b20  4d 65 6e 75 55 74 69 6c  5f 53 68 6f 77 53 75 62  |MenuUtil_ShowSub|
00004b30  4d 65 6e 75 20 74 6f 20  64 69 73 70 6c 61 79 20  |Menu to display |
00004b40  61 70 70 72 6f 70 72 69  61 74 65 20 6f 62 6a 65  |appropriate obje|
00004b50  63 74 2e 0a 0a 49 66 20  52 30 20 69 6e 73 74 65  |ct...If R0 inste|
00004b60  61 64 20 6f 66 20 69 74  65 6d 20 68 61 6e 64 6c  |ad of item handl|
00004b70  65 20 63 6f 6e 74 61 69  6e 73 20 6d 65 6e 75 20  |e contains menu |
00004b80  68 61 6e 64 6c 65 20 74  68 65 6e 20 74 68 65 20  |handle then the |
00004b90  73 74 61 74 65 20 6f 66  0a 74 68 65 20 66 6c 61  |state of.the fla|
00004ba0  67 20 77 69 6c 6c 20 62  65 20 63 68 61 6e 67 65  |g will be change|
00004bb0  64 20 69 6e 20 61 6c 6c  20 69 74 65 6d 73 20 6f  |d in all items o|
00004bc0  66 20 74 68 69 73 20 6d  65 6e 75 2e 0a 0a 49 74  |f this menu...It|
00004bd0  20 69 73 20 63 6f 6e 76  65 6e 69 65 6e 74 20 74  | is convenient t|
00004be0  6f 20 70 61 73 73 20 69  6e 20 52 31 20 74 68 65  |o pass in R1 the|
00004bf0  20 72 65 73 75 6c 74 20  6f 66 20 6c 6f 67 69 63  | result of logic|
00004c00  61 6c 20 65 78 70 72 65  73 73 69 6f 6e 20 28 74  |al expression (t|
00004c10  6f 0a 73 65 74 20 66 6c  61 67 20 69 66 20 72 65  |o.set flag if re|
00004c20  73 75 6c 74 20 69 73 20  54 52 55 45 20 61 6e 64  |sult is TRUE and|
00004c30  20 74 6f 20 63 6c 65 61  72 20 69 74 20 69 66 20  | to clear it if |
00004c40  46 41 4c 53 45 29 2e 0a  0a 20 45 78 61 6d 70 6c  |FALSE)... Exampl|
00004c50  65 20 63 6f 64 65 3a 0a  20 47 65 6e 65 72 61 74  |e code:. Generat|
00004c60  65 20 6d 65 73 73 61 67  65 20 77 68 65 6e 20 6d  |e message when m|
00004c70  6f 76 69 6e 67 20 74 6f  20 74 68 65 20 66 6f 6e  |oving to the fon|
00004c80  74 73 20 73 75 62 6d 65  6e 75 3a 0a 20 53 59 53  |ts submenu:. SYS|
00004c90  20 22 4d 65 6e 75 55 74  69 6c 5f 57 61 72 6e 69  | "MenuUtil_Warni|
00004ca0  6e 67 22 2c 66 6f 6e 74  73 49 74 65 6d 25 2c 54  |ng",fontsItem%,T|
00004cb0  52 55 45 0a 20 0a 0a 0a  0a 0a 20 4d 65 6e 75 55  |RUE. ..... MenuU|
00004cc0  74 69 6c 5f 57 72 69 74  61 62 6c 65 20 28 53 57  |til_Writable (SW|
00004cd0  49 20 26 34 35 42 43 44  29 0a 20 2d 2d 2d 2d 2d  |I &45BCD). -----|
00004ce0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00004cf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 20 4d 61 6b 65 73  |---------. Makes|
00004d00  20 6d 65 6e 75 20 69 74  65 6d 20 77 72 69 74 61  | menu item writa|
00004d10  62 6c 65 2e 0a 0a 20 45  6e 74 72 79 3a 0a 20 20  |ble... Entry:.  |
00004d20  20 20 20 52 30 20 3d 20  68 61 6e 64 6c 65 20 6f  |   R0 = handle o|
00004d30  66 20 6d 65 6e 75 20 69  74 65 6d 20 6f 72 20 7a  |f menu item or z|
00004d40  65 72 6f 20 66 6f 72 20  63 75 72 72 65 6e 74 20  |ero for current |
00004d50  69 74 65 6d 20 6f 72 20  68 61 6e 64 6c 65 20 6f  |item or handle o|
00004d60  66 20 74 68 65 20 6d 65  6e 75 0a 20 20 20 20 20  |f the menu.     |
00004d70  52 31 20 3c 3e 30 20 61  6e 64 0a 20 20 20 20 20  |R1 <>0 and.     |
00004d80  52 32 20 3d 20 62 75 66  66 65 72 20 73 69 7a 65  |R2 = buffer size|
00004d90  0a 20 20 20 20 20 52 33  20 2d 3e 20 70 6f 69 6e  |.     R3 -> poin|
00004da0  74 65 72 20 74 6f 20 76  61 6c 69 64 61 74 69 6f  |ter to validatio|
00004db0  6e 20 73 74 72 69 6e 67  2c 20 6f 72 0a 0a 20 20  |n string, or..  |
00004dc0  20 20 20 52 31 20 3d 30  20 6d 61 6b 65 73 20 69  |   R1 =0 makes i|
00004dd0  74 65 6d 20 6e 6f 74 20  77 72 69 74 61 62 6c 65  |tem not writable|
00004de0  0a 45 78 69 74 3a 0a 20  20 20 20 20 52 30 2d 52  |.Exit:.     R0-R|
00004df0  33 20 70 72 65 73 65 72  76 65 64 0a 0a 49 66 20  |3 preserved..If |
00004e00  52 31 20 69 73 20 6e 6f  74 20 7a 65 72 6f 20 6f  |R1 is not zero o|
00004e10  6e 20 65 6e 74 72 79 20  74 68 65 6e 20 74 68 69  |n entry then thi|
00004e20  73 20 63 61 6c 6c 20 77  69 6c 6c 20 63 6f 6e 76  |s call will conv|
00004e30  65 72 74 20 65 78 69 73  74 69 6e 67 20 6d 65 6e  |ert existing men|
00004e40  75 20 69 74 65 6d 0a 69  6e 74 6f 20 77 72 69 74  |u item.into writ|
00004e50  61 62 6c 65 20 69 74 65  6d 2e 20 52 30 20 6d 75  |able item. R0 mu|
00004e60  73 74 20 63 6f 6e 74 61  69 6e 20 74 68 65 20 68  |st contain the h|
00004e70  61 6e 64 6c 65 20 6f 66  20 74 68 65 20 6d 65 6e  |andle of the men|
00004e80  75 20 69 74 65 6d 20 6f  72 20 7a 65 72 6f 20 66  |u item or zero f|
00004e90  6f 72 0a 63 75 72 72 65  6e 74 20 69 74 65 6d 2e  |or.current item.|
00004ea0  20 49 66 20 52 30 20 63  6f 6e 74 61 69 6e 73 20  | If R0 contains |
00004eb0  68 61 6e 64 6c 65 20 6f  66 20 74 68 65 20 6d 65  |handle of the me|
00004ec0  6e 75 20 74 68 65 6e 20  61 6c 6c 20 74 68 65 20  |nu then all the |
00004ed0  69 74 65 6d 73 20 69 6e  20 74 68 69 73 0a 6d 65  |items in this.me|
00004ee0  6e 75 20 77 69 6c 6c 20  62 65 20 63 6f 6e 76 65  |nu will be conve|
00004ef0  72 74 65 64 2e 20 0a 0a  52 32 20 6f 6e 20 65 6e  |rted. ..R2 on en|
00004f00  74 72 79 20 63 6f 6e 74  61 69 6e 73 20 74 68 65  |try contains the|
00004f10  20 6c 65 6e 67 74 68 20  6f 66 20 74 68 65 20 62  | length of the b|
00004f20  75 66 66 65 72 20 66 6f  72 20 74 68 65 20 69 6e  |uffer for the in|
00004f30  70 75 74 20 73 74 72 69  6e 67 2e 0a 54 68 65 20  |put string..The |
00004f40  76 61 6c 75 65 20 69 6e  20 52 32 20 6d 75 73 74  |value in R2 must|
00004f50  20 62 65 20 6e 6f 74 20  6c 65 73 73 20 74 68 65  | be not less the|
00004f60  6e 20 74 68 65 20 6c 65  6e 67 74 68 20 6f 66 20  |n the length of |
00004f70  74 68 65 20 63 75 72 72  65 6e 74 20 69 74 65 6d  |the current item|
00004f80  0a 74 65 78 74 2e 20 49  6e 20 74 68 65 20 6c 61  |.text. In the la|
00004f90  74 74 65 72 20 63 61 73  65 20 74 68 65 20 62 75  |tter case the bu|
00004fa0  66 66 65 72 20 77 69 6c  6c 20 72 65 6d 61 69 6e  |ffer will remain|
00004fb0  20 75 6e 63 68 61 6e 67  65 64 2e 0a 0a 49 66 20  | unchanged...If |
00004fc0  52 33 3c 3e 30 20 6f 6e  20 65 6e 74 72 79 20 74  |R3<>0 on entry t|
00004fd0  68 65 6e 20 69 74 20 70  6f 69 6e 74 73 20 74 6f  |hen it points to|
00004fe0  20 74 68 65 20 63 74 72  6c 2d 74 65 72 6d 69 6e  | the ctrl-termin|
00004ff0  61 74 65 64 20 76 61 6c  69 64 61 74 69 6f 6e 0a  |ated validation.|
00005000  73 74 72 69 6e 67 2e 20  54 68 65 20 6d 6f 64 75  |string. The modu|
00005010  6c 65 20 6d 61 6b 65 73  20 69 74 73 20 6f 77 6e  |le makes its own|
00005020  20 63 6f 70 79 20 6f 66  20 74 68 65 20 73 74 72  | copy of the str|
00005030  69 6e 67 2e 20 49 66 20  52 33 3d 30 20 6f 6e 20  |ing. If R3=0 on |
00005040  65 6e 74 72 79 0a 74 68  65 6e 20 6e 6f 20 76 61  |entry.then no va|
00005050  6c 69 64 61 74 69 6f 6e  20 73 74 72 69 6e 67 20  |lidation string |
00005060  77 69 6c 6c 20 62 65 20  75 73 65 64 2e 0a 0a 49  |will be used...I|
00005070  66 20 52 31 20 69 73 20  7a 65 72 6f 20 6f 6e 20  |f R1 is zero on |
00005080  65 6e 74 72 79 20 74 68  65 6e 20 74 68 65 20 69  |entry then the i|
00005090  74 65 6d 20 77 69 6c 6c  20 62 65 20 63 6f 6e 76  |tem will be conv|
000050a0  65 72 74 65 64 20 62 61  63 6b 20 69 6e 74 6f 20  |erted back into |
000050b0  6f 72 64 69 6e 61 72 79  0a 6d 65 6e 75 20 69 74  |ordinary.menu it|
000050c0  65 6d 2e 20 49 6e 20 74  68 69 73 20 63 61 73 65  |em. In this case|
000050d0  20 63 6f 6e 74 65 6e 74  73 20 6f 66 20 72 65 67  | contents of reg|
000050e0  69 73 74 65 72 73 20 52  32 20 61 6e 64 20 52 33  |isters R2 and R3|
000050f0  20 77 69 6c 6c 20 62 65  20 69 67 6e 6f 72 65 64  | will be ignored|
00005100  2e 0a 0a 20 45 78 61 6d  70 6c 65 20 63 6f 64 65  |... Example code|
00005110  3a 0a 20 4d 61 6b 65 20  63 75 72 72 65 6e 74 20  |:. Make current |
00005120  69 74 65 6d 20 77 72 69  74 61 62 6c 65 20 77 69  |item writable wi|
00005130  74 68 6f 75 74 20 76 61  6c 69 64 61 74 69 6f 6e  |thout validation|
00005140  20 73 74 72 69 6e 67 0a  20 53 59 53 20 22 4d 65  | string. SYS "Me|
00005150  6e 75 55 74 69 6c 5f 57  72 69 74 61 62 6c 65 22  |nuUtil_Writable"|
00005160  2c 2c 54 52 55 45 0a 0a  20 4d 61 6b 65 20 6d 65  |,,TRUE.. Make me|
00005170  6e 75 20 69 74 65 6d 20  77 69 74 68 20 68 61 6e  |nu item with han|
00005180  64 6c 65 20 77 69 64 74  68 49 74 65 6d 25 20 77  |dle widthItem% w|
00005190  72 69 74 61 62 6c 65 2c  20 77 69 74 68 20 62 75  |ritable, with bu|
000051a0  66 66 65 72 20 73 69 7a  65 20 34 30 20 61 6e 64  |ffer size 40 and|
000051b0  0a 61 6c 6c 6f 77 20 74  6f 20 65 6e 74 65 72 20  |.allow to enter |
000051c0  74 6f 20 69 74 20 6f 6e  6c 79 20 64 69 67 69 74  |to it only digit|
000051d0  73 2e 0a 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |s.. SYS "MenuUti|
000051e0  6c 5f 57 72 69 74 61 62  6c 65 22 2c 77 69 64 74  |l_Writable",widt|
000051f0  68 49 74 65 6d 25 2c 54  52 55 45 2c 34 30 2c 22  |hItem%,TRUE,40,"|
00005200  41 30 2d 39 22 0a 0a 0a  0a 0a 0a 20 4d 65 6e 75  |A0-9"...... Menu|
00005210  55 74 69 6c 5f 53 75 62  6d 65 6e 75 20 28 53 57  |Util_Submenu (SW|
00005220  49 20 26 34 35 42 43 45  29 0a 20 2d 2d 2d 2d 2d  |I &45BCE). -----|
00005230  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00005240  2d 2d 2d 2d 2d 2d 2d 2d  0a 20 4c 69 6e 6b 73 20  |--------. Links |
00005250  73 75 62 6d 65 6e 75 20  74 6f 20 6d 65 6e 75 20  |submenu to menu |
00005260  69 74 65 6d 0a 0a 20 45  6e 74 72 79 3a 0a 20 20  |item.. Entry:.  |
00005270  20 20 20 52 30 20 68 61  6e 64 6c 65 20 6f 66 20  |   R0 handle of |
00005280  74 68 65 20 6d 65 6e 75  20 69 74 65 6d 20 6f 72  |the menu item or|
00005290  20 7a 65 72 6f 20 69 66  20 63 75 72 72 65 6e 74  | zero if current|
000052a0  20 6d 65 6e 75 20 69 74  65 6d 0a 20 20 20 20 20  | menu item.     |
000052b0  52 31 20 68 61 6e 64 6c  65 20 6f 66 20 73 75 62  |R1 handle of sub|
000052c0  6d 65 6e 75 20 6f 72 20  70 6f 69 6e 74 65 72 20  |menu or pointer |
000052d0  74 6f 20 73 75 62 6d 65  6e 75 20 6f 72 20 77 69  |to submenu or wi|
000052e0  6e 64 6f 77 20 68 61 6e  64 6c 65 0a 20 20 20 20  |ndow handle.    |
000052f0  20 20 20 20 69 66 20 52  31 3c 26 38 30 30 30 20  |    if R1<&8000 |
00005300  74 68 65 6e 20 52 31 20  69 73 20 77 69 6e 64 6f  |then R1 is windo|
00005310  77 20 68 61 6e 64 6c 65  0a 20 20 20 20 20 20 20  |w handle.       |
00005320  20 69 66 20 52 31 3e 26  38 30 30 30 20 74 68 65  | if R1>&8000 the|
00005330  6e 20 52 31 20 69 73 20  70 6f 69 6e 74 65 72 20  |n R1 is pointer |
00005340  74 6f 20 6d 65 6e 75 20  0a 20 20 20 20 20 20 20  |to menu .       |
00005350  20 69 66 20 52 31 3c 30  20 74 68 65 6e 20 52 31  | if R1<0 then R1|
00005360  20 69 73 20 6d 65 6e 75  20 68 61 6e 64 6c 65 0a  | is menu handle.|
00005370  0a 20 45 78 69 74 3a 0a  20 20 20 20 20 52 30 2c  |. Exit:.     R0,|
00005380  52 31 20 70 72 65 73 65  72 76 65 64 0a 0a 54 68  |R1 preserved..Th|
00005390  69 73 20 63 61 6c 6c 20  69 73 20 75 73 65 64 20  |is call is used |
000053a0  66 6f 72 20 63 6f 6e 73  74 72 75 63 74 69 6e 67  |for constructing|
000053b0  20 6d 75 6c 74 69 6c 65  76 65 6c 20 6d 65 6e 75  | multilevel menu|
000053c0  73 2e 20 52 30 20 6f 6e  20 65 6e 74 72 79 0a 63  |s. R0 on entry.c|
000053d0  6f 6e 74 61 69 6e 73 20  74 68 65 20 68 61 6e 64  |ontains the hand|
000053e0  6c 65 20 6f 66 20 6d 65  6e 75 20 69 74 65 6d 2e  |le of menu item.|
000053f0  20 54 68 69 73 20 69 74  65 6d 20 69 73 20 6c 69  | This item is li|
00005400  6e 6b 65 64 20 77 69 74  68 20 73 75 62 6d 65 6e  |nked with submen|
00005410  75 20 6f 72 0a 64 69 61  6c 6f 67 20 62 6f 78 20  |u or.dialog box |
00005420  64 65 70 65 6e 64 69 6e  67 20 6f 6e 20 63 6f 6e  |depending on con|
00005430  74 65 6e 74 73 20 6f 66  20 52 31 2e 20 54 6f 20  |tents of R1. To |
00005440  63 6f 6e 6e 65 63 74 20  73 75 62 6d 65 6e 75 20  |connect submenu |
00005450  52 31 20 6d 61 79 0a 63  6f 6e 74 61 69 6e 20 6d  |R1 may.contain m|
00005460  65 6e 75 20 68 61 6e 64  6c 65 20 28 61 73 20 72  |enu handle (as r|
00005470  65 74 75 72 6e 65 64 20  62 79 20 22 4d 65 6e 75  |eturned by "Menu|
00005480  55 74 69 6c 5f 4e 65 77  22 29 20 6f 72 20 61 62  |Util_New") or ab|
00005490  73 6f 6c 75 74 65 20 70  6f 69 6e 74 65 72 20 74  |solute pointer t|
000054a0  6f 0a 74 68 65 20 6d 65  6e 75 20 64 61 74 61 20  |o.the menu data |
000054b0  73 74 72 75 63 74 75 72  65 2e 20 54 6f 20 63 6f  |structure. To co|
000054c0  6e 6e 65 63 74 20 64 69  61 6c 6f 67 20 62 6f 78  |nnect dialog box|
000054d0  20 52 31 20 6d 75 73 74  20 63 6f 6e 74 61 69 6e  | R1 must contain|
000054e0  20 77 69 6e 64 6f 77 0a  68 61 6e 64 6c 65 20 6f  | window.handle o|
000054f0  66 20 64 69 61 6c 6f 67  20 62 6f 78 20 28 61 73  |f dialog box (as|
00005500  20 72 65 74 75 72 6e 65  64 20 62 79 20 22 57 69  | returned by "Wi|
00005510  6d 70 5f 43 72 65 61 74  65 57 69 6e 64 6f 77 22  |mp_CreateWindow"|
00005520  29 2e 0a 0a 0a 20 45 78  61 6d 70 6c 65 20 63 6f  |).... Example co|
00005530  64 65 3a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |de:.            |
00005540  20 20 20 20 20 20 20 20  20 20 20 20 0a 20 43 6f  |            . Co|
00005550  6e 6e 65 63 74 20 22 41  62 6f 75 74 20 74 68 69  |nnect "About thi|
00005560  73 20 70 72 6f 67 72 61  6d 22 20 77 69 6e 64 6f  |s program" windo|
00005570  77 20 74 6f 20 74 68 65  20 69 74 65 6d 20 22 49  |w to the item "I|
00005580  6e 66 6f 22 0a 20 53 59  53 20 22 57 69 6d 70 5f  |nfo". SYS "Wimp_|
00005590  43 72 65 61 74 65 57 69  6e 64 6f 77 22 2c 2c 62  |CreateWindow",,b|
000055a0  6c 6f 63 6b 25 20 54 4f  20 69 6e 66 6f 57 69 6e  |lock% TO infoWin|
000055b0  64 6f 77 25 0a 20 53 59  53 20 22 4d 65 6e 75 55  |dow%. SYS "MenuU|
000055c0  74 69 6c 5f 53 75 62 6d  65 6e 75 22 2c 69 6e 66  |til_Submenu",inf|
000055d0  6f 49 74 65 6d 25 2c 69  6e 66 6f 57 69 6e 64 6f  |oItem%,infoWindo|
000055e0  77 25 0a 0a 20 43 72 65  61 74 65 20 22 44 69 73  |w%.. Create "Dis|
000055f0  70 6c 61 79 22 20 69 74  65 6d 20 69 6e 20 66 69  |play" item in fi|
00005600  6c 65 72 20 6d 65 6e 75  20 20 0a 20 53 59 53 20  |ler menu  . SYS |
00005610  22 4d 65 6e 75 55 74 69  6c 5f 4e 65 77 22 2c 2c  |"MenuUtil_New",,|
00005620  22 46 69 6c 65 72 22 0a  20 53 59 53 20 22 4d 65  |"Filer". SYS "Me|
00005630  6e 75 55 74 69 6c 5f 41  64 64 22 2c 2c 22 44 69  |nuUtil_Add",,"Di|
00005640  73 70 6c 61 79 22 0a 20  53 59 53 20 22 4d 65 6e  |splay". SYS "Men|
00005650  75 55 74 69 6c 5f 53 75  62 6d 65 6e 75 22 2c 2c  |uUtil_Submenu",,|
00005660  64 69 73 70 4d 65 6e 75  25 20 20 20 0a 20 0a 0a  |dispMenu%   . ..|
00005670  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00005680  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005690  20 0a 20 4d 65 6e 75 55  74 69 6c 5f 43 6f 6c 6f  | . MenuUtil_Colo|
000056a0  75 72 4d 65 6e 75 20 28  53 57 49 20 26 34 35 42  |urMenu (SWI &45B|
000056b0  43 46 29 0a 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |CF). -----------|
000056c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000056d0  2d 2d 2d 2d 2d 0a 20 43  72 65 61 74 65 73 20 61  |-----. Creates a|
000056e0  20 77 69 6d 70 20 63 6f  6c 6f 75 72 20 73 65 74  | wimp colour set|
000056f0  74 69 6e 67 20 6d 65 6e  75 0a 20 45 6e 74 72 79  |ting menu. Entry|
00005700  3a 0a 20 20 20 20 20 52  31 20 2d 3e 20 6d 65 6e  |:.     R1 -> men|
00005710  75 20 74 69 74 6c 65 20  73 74 72 69 6e 67 0a 20  |u title string. |
00005720  20 20 20 20 52 32 20 2d  3e 20 6d 65 6e 75 20 68  |    R2 -> menu h|
00005730  61 6e 64 6c 65 0a 20 45  78 69 74 3a 20 20 20 20  |andle. Exit:    |
00005740  20 20 20 20 20 20 20 20  20 20 20 20 20 0a 20 20  |             .  |
00005750  20 20 20 52 30 20 3d 20  68 61 6e 64 6c 65 20 6f  |   R0 = handle o|
00005760  66 20 74 68 65 20 6d 65  6e 75 0a 20 20 20 20 20  |f the menu.     |
00005770  52 31 20 70 72 65 73 65  72 76 65 64 0a 0a 54 68  |R1 preserved..Th|
00005780  69 73 20 63 61 6c 6c 20  63 72 65 61 74 65 73 20  |is call creates |
00005790  73 74 61 6e 64 61 72 64  20 57 49 4d 50 20 63 6f  |standard WIMP co|
000057a0  6c 6f 75 72 20 73 65 74  74 69 6e 67 20 6d 65 6e  |lour setting men|
000057b0  75 2e 20 52 31 20 6f 6e  20 65 6e 74 72 79 0a 70  |u. R1 on entry.p|
000057c0  6f 69 6e 74 73 20 74 6f  20 74 68 65 20 74 69 74  |oints to the tit|
000057d0  6c 65 20 73 74 72 69 6e  67 20 66 6f 72 20 74 68  |le string for th|
000057e0  65 20 6d 65 6e 75 2e 20  49 66 20 52 32 3c 3e 30  |e menu. If R2<>0|
000057f0  20 74 68 65 6e 20 69 74  20 70 6f 69 6e 74 73 20  | then it points |
00005800  74 6f 0a 74 68 65 20 68  61 6e 64 6c 65 72 20 63  |to.the handler c|
00005810  6f 6d 6d 6f 6e 20 66 6f  72 20 61 6c 6c 20 31 36  |ommon for all 16|
00005820  20 69 74 65 6d 73 2e 20  28 53 65 65 20 61 6c 73  | items. (See als|
00005830  6f 20 22 4d 65 6e 75 55  74 69 6c 5f 41 64 64 22  |o "MenuUtil_Add"|
00005840  20 66 6f 72 20 6d 6f 72  65 0a 69 6e 66 6f 20 61  | for more.info a|
00005850  62 6f 75 74 20 69 74 65  6d 20 68 61 6e 64 6c 65  |bout item handle|
00005860  72 73 29 2e 20 44 65 73  70 69 74 65 20 74 68 65  |rs). Despite the|
00005870  20 66 61 63 74 20 74 68  61 74 20 74 68 65 20 73  | fact that the s|
00005880  61 6d 65 20 68 61 6e 64  6c 65 72 20 69 73 0a 69  |ame handler is.i|
00005890  6e 76 6f 6b 65 64 20 77  69 74 68 20 61 6c 6c 20  |nvoked with all |
000058a0  69 74 65 6d 73 20 69 74  20 69 73 20 73 74 69 6c  |items it is stil|
000058b0  6c 20 70 6f 73 73 69 62  6c 65 20 74 6f 20 64 69  |l possible to di|
000058c0  73 74 69 6e 67 75 69 73  68 20 75 73 65 72 0a 73  |stinguish user.s|
000058d0  65 6c 65 63 74 69 6f 6e  2e 20 4d 65 6e 75 55 74  |election. MenuUt|
000058e0  69 6c 5f 44 65 63 6f 64  65 20 72 65 74 75 72 6e  |il_Decode return|
000058f0  73 20 6e 6f 74 20 6f 6e  6c 79 20 70 6f 69 6e 74  |s not only point|
00005900  65 72 20 74 6f 20 74 68  65 20 68 61 6e 64 6c 65  |er to the handle|
00005910  72 20 62 75 74 0a 61 6c  73 6f 20 74 68 65 20 6e  |r but.also the n|
00005920  75 6d 62 65 72 20 28 70  6f 73 69 74 69 6f 6e 29  |umber (position)|
00005930  20 6f 66 20 73 65 6c 65  63 74 65 64 20 69 74 65  | of selected ite|
00005940  6d 20 69 6e 20 74 68 65  20 6d 65 6e 75 2e 20 41  |m in the menu. A|
00005950  63 74 75 61 6c 6c 79 20  74 68 69 73 0a 6e 75 6d  |ctually this.num|
00005960  62 65 72 20 69 73 20 65  71 75 61 6c 20 74 6f 20  |ber is equal to |
00005970  74 68 65 20 63 6f 6c 6f  75 72 20 6e 75 6d 62 65  |the colour numbe|
00005980  72 2e 0a 0a 0a 20 45 78  61 6d 70 6c 65 20 63 6f  |r.... Example co|
00005990  64 65 3a 0a 20 43 72 65  61 74 65 20 63 6f 6c 6f  |de:. Create colo|
000059a0  75 72 20 73 65 74 74 69  6e 67 20 6d 65 6e 75 3a  |ur setting menu:|
000059b0  0a 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |. SYS "MenuUtil_|
000059c0  43 6f 6c 6f 75 72 4d 65  6e 75 22 2c 2c 22 43 6f  |ColourMenu",,"Co|
000059d0  6c 6f 75 72 22 20 54 4f  20 63 6f 6c 6f 75 72 4d  |lour" TO colourM|
000059e0  65 6e 75 25 0a 0a 0a 0a  0a 20 4d 65 6e 75 55 74  |enu%..... MenuUt|
000059f0  69 6c 5f 43 6f 6c 6f 75  72 73 20 28 53 57 49 20  |il_Colours (SWI |
00005a00  26 34 35 42 44 30 29 0a  20 2d 2d 2d 2d 2d 2d 2d  |&45BD0). -------|
00005a10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00005a20  2d 2d 2d 2d 2d 2d 0a 20  53 65 74 73 20 6e 65 77  |------. Sets new|
00005a30  20 66 6f 72 65 67 72 6f  75 6e 64 20 61 6e 64 20  | foreground and |
00005a40  62 61 63 6b 67 72 6f 75  6e 64 20 63 6f 6c 6f 75  |background colou|
00005a50  72 73 20 6f 66 20 6d 65  6e 75 20 69 74 65 6d 0a  |rs of menu item.|
00005a60  0a 20 45 6e 74 72 79 3a  0a 20 20 20 20 20 52 30  |. Entry:.     R0|
00005a70  20 3d 20 68 61 6e 64 6c  65 20 6f 66 20 74 68 65  | = handle of the|
00005a80  20 6d 65 6e 75 20 69 74  65 6d 20 6f 72 20 7a 65  | menu item or ze|
00005a90  72 6f 20 66 6f 72 20 63  75 72 72 65 6e 74 20 69  |ro for current i|
00005aa0  74 65 6d 0a 20 20 20 20  20 52 31 20 3d 20 66 6f  |tem.     R1 = fo|
00005ab0  72 65 67 72 6f 75 6e 64  20 63 6f 6c 6f 75 72 0a  |reground colour.|
00005ac0  20 20 20 20 20 52 32 20  3d 20 62 61 63 6b 67 72  |     R2 = backgr|
00005ad0  6f 75 6e 64 20 63 6f 6c  6f 75 72 0a 20 45 78 69  |ound colour. Exi|
00005ae0  74 3a 0a 20 20 20 20 20  52 30 2d 52 32 20 70 72  |t:.     R0-R2 pr|
00005af0  65 73 65 72 76 65 64 0a  0a 54 68 69 73 20 63 61  |eserved..This ca|
00005b00  6c 6c 20 61 6c 6c 6f 77  73 20 79 6f 75 20 74 6f  |ll allows you to|
00005b10  20 63 68 61 6e 67 65 20  63 6f 6c 6f 75 72 73 20  | change colours |
00005b20  6f 66 20 70 61 72 74 69  63 75 6c 61 72 20 6d 65  |of particular me|
00005b30  6e 75 20 69 74 65 6d 2e  20 43 6f 6c 6f 75 72 73  |nu item. Colours|
00005b40  20 6d 75 73 74 0a 62 65  20 73 65 6c 65 63 74 65  | must.be selecte|
00005b50  64 20 66 72 6f 6d 20 31  36 20 57 69 6d 70 20 63  |d from 16 Wimp c|
00005b60  6f 6c 6f 75 72 73 2e 0a  20 20 20 20 20 20 20 20  |olours..        |
00005b70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005b80  20 20 20 20 20 20 20 20  20 20 20 0a 20 45 78 61  |           . Exa|
00005b90  6d 70 6c 65 20 63 6f 64  65 3a 0a 20 43 68 61 6e  |mple code:. Chan|
00005ba0  67 65 20 63 6f 6c 6f 75  72 73 20 6f 66 20 63 75  |ge colours of cu|
00005bb0  72 72 65 6e 74 20 69 74  65 6d 20 74 6f 20 62 6c  |rrent item to bl|
00005bc0  61 63 6b 20 6f 6e 20 79  65 6c 6c 6f 77 0a 20 53  |ack on yellow. S|
00005bd0  59 53 20 22 4d 65 6e 75  55 74 69 6c 5f 43 6f 6c  |YS "MenuUtil_Col|
00005be0  6f 75 72 73 22 2c 2c 37  2c 39 0a 0a 20 20 20 20  |ours",,7,9..    |
00005bf0  20 20 20 20 20 20 20 0a  0a 0a 20 4d 65 6e 75 55  |       ... MenuU|
00005c00  74 69 6c 5f 54 69 63 6b  4f 6e 6c 79 20 28 53 57  |til_TickOnly (SW|
00005c10  49 20 26 34 35 42 44 31  29 0a 20 2d 2d 2d 2d 2d  |I &45BD1). -----|
00005c20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00005c30  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 20 54 69 63 6b 20  |---------. Tick |
00005c40  6f 6e 6c 79 20 73 70 65  63 69 66 69 65 64 20 6d  |only specified m|
00005c50  65 6e 75 20 69 74 65 6d  0a 0a 20 45 6e 74 72 79  |enu item.. Entry|
00005c60  3a 0a 20 20 20 20 20 52  30 20 3d 20 68 61 6e 64  |:.     R0 = hand|
00005c70  6c 65 20 6f 66 20 74 68  65 20 6d 65 6e 75 20 69  |le of the menu i|
00005c80  74 65 6d 20 6f 72 20 7a  65 72 6f 20 66 6f 72 20  |tem or zero for |
00005c90  63 75 72 72 65 6e 74 20  69 74 65 6d 2c 20 6f 72  |current item, or|
00005ca0  0a 20 20 20 20 20 20 20  20 20 20 0a 20 20 20 20  |.          .    |
00005cb0  20 52 30 20 3d 20 68 61  6e 64 6c 65 20 6f 66 20  | R0 = handle of |
00005cc0  74 68 65 20 6d 65 6e 75  0a 20 20 20 20 20 52 31  |the menu.     R1|
00005cd0  20 3d 20 69 74 65 6d 20  70 6f 73 69 74 69 6f 6e  | = item position|
00005ce0  20 69 6e 20 74 68 65 20  6d 65 6e 75 20 28 73 74  | in the menu (st|
00005cf0  61 72 74 69 6e 67 20 66  72 6f 6d 20 7a 65 72 6f  |arting from zero|
00005d00  29 0a 20 45 78 69 74 3a  0a 20 20 20 20 20 52 30  |). Exit:.     R0|
00005d10  2c 52 31 20 70 72 65 73  65 72 76 65 64 0a 0a 54  |,R1 preserved..T|
00005d20  68 69 73 20 63 61 6c 6c  20 74 69 63 6b 73 20 73  |his call ticks s|
00005d30  70 65 63 69 66 69 65 64  20 69 74 65 6d 20 61 6e  |pecified item an|
00005d40  64 20 63 6c 65 61 72 73  20 74 69 63 6b 20 66 6c  |d clears tick fl|
00005d50  61 67 73 20 69 6e 20 72  65 6d 61 69 6e 69 6e 67  |ags in remaining|
00005d60  20 69 74 65 6d 73 20 69  6e 0a 74 68 65 20 6d 65  | items in.the me|
00005d70  6e 75 2e 20 49 66 20 79  6f 75 20 64 6f 6e 27 74  |nu. If you don't|
00005d80  20 6b 6e 6f 77 20 74 68  65 20 68 61 6e 64 6c 65  | know the handle|
00005d90  20 6f 66 20 74 68 65 20  6d 65 6e 75 20 74 68 65  | of the menu the|
00005da0  6e 20 79 6f 75 20 63 61  6e 20 73 70 65 63 69 66  |n you can specif|
00005db0  79 0a 68 61 6e 64 6c 65  20 6f 66 20 74 68 65 20  |y.handle of the |
00005dc0  6d 65 6e 75 20 69 6e 20  52 30 20 61 6e 64 20 70  |menu in R0 and p|
00005dd0  6f 73 69 74 69 6f 6e 20  6f 66 20 74 68 65 20 69  |osition of the i|
00005de0  74 65 6d 20 69 6e 20 52  31 2e 0a 0a 0a 20 45 78  |tem in R1.... Ex|
00005df0  61 6d 70 6c 65 20 63 6f  64 65 3a 0a 20 54 69 63  |ample code:. Tic|
00005e00  6b 20 62 6c 61 63 6b 20  63 6f 6c 6f 75 72 20 69  |k black colour i|
00005e10  6e 20 63 6f 6c 6f 75 72  20 6d 65 6e 75 0a 20 53  |n colour menu. S|
00005e20  59 53 20 22 4d 65 6e 75  55 74 69 6c 5f 54 69 63  |YS "MenuUtil_Tic|
00005e30  6b 4f 6e 6c 79 22 2c 63  6f 6c 6f 75 72 4d 65 6e  |kOnly",colourMen|
00005e40  75 25 2c 37 0a 0a 0a 2d  2d 2d 2d 2d 2d 2d 2d 2d  |u%,7...---------|
00005e50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00005e80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 20 20  |-------------.  |
00005e90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005ea0  20 20 20 4e 6f 74 65 73  20 66 72 6f 6d 20 74 68  |   Notes from th|
00005eb0  65 20 61 75 74 68 6f 72  0a 0a 0a 4d 65 6e 75 55  |e author...MenuU|
00005ec0  74 69 6c 73 20 69 73 20  66 72 65 65 77 61 72 65  |tils is freeware|
00005ed0  20 73 6f 66 74 77 61 72  65 2e 20 45 76 65 72 79  | software. Every|
00005ee0  62 6f 64 79 20 69 73 20  66 72 65 65 20 74 6f 20  |body is free to |
00005ef0  75 73 65 20 4d 65 6e 75  55 74 69 6c 73 0a 6d 6f  |use MenuUtils.mo|
00005f00  64 75 6c 65 2c 20 65 76  65 6e 20 69 6e 20 63 6f  |dule, even in co|
00005f10  6d 6d 65 72 63 69 61 6c  20 63 6f 64 65 2e 20 49  |mmercial code. I|
00005f20  6e 20 63 61 73 65 20 6f  66 20 63 6f 6d 6d 65 72  |n case of commer|
00005f30  63 69 61 6c 20 75 73 65  20 49 20 77 6f 75 6c 64  |cial use I would|
00005f40  0a 6c 69 6b 65 20 74 6f  20 6b 6e 6f 77 20 74 68  |.like to know th|
00005f50  69 73 20 69 6e 20 61 64  76 61 6e 63 65 20 28 49  |is in advance (I|
00005f60  20 63 6f 75 6c 64 20 74  68 61 6e 20 70 72 6f 76  | could than prov|
00005f70  69 64 65 20 79 6f 75 20  77 69 74 68 20 74 68 65  |ide you with the|
00005f80  20 6c 61 74 65 73 74 0a  72 65 6c 65 61 73 65 29  | latest.release)|
00005f90  2e 20 59 6f 75 20 63 61  6e 20 61 6c 77 61 79 73  |. You can always|
00005fa0  20 63 6f 6e 74 61 63 74  20 6d 65 20 69 66 20 79  | contact me if y|
00005fb0  6f 75 20 66 6f 75 6e 64  20 73 6f 6d 65 20 62 75  |ou found some bu|
00005fc0  67 2c 20 6f 72 20 77 68  65 6e 0a 68 61 76 69 6e  |g, or when.havin|
00005fd0  67 20 6f 74 68 65 72 20  73 75 67 67 65 73 74 69  |g other suggesti|
00005fe0  6f 6e 73 2e 0a 0a 20 20  20 20 20 20 20 20 20 54  |ons...         T|
00005ff0  6f 20 63 6f 6e 74 61 63  74 20 74 68 65 20 61 75  |o contact the au|
00006000  74 68 6f 72 20 6f 66 20  4d 65 6e 75 55 74 69 6c  |thor of MenuUtil|
00006010  73 2c 20 70 6c 65 61 73  65 20 77 72 69 74 65 20  |s, please write |
00006020  74 6f 3a 0a 20 20 20 20  20 20 20 20 20 20 20 20  |to:.            |
00006030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006040  20 20 20 20 20 20 20 20  20 20 0a 20 20 20 20 20  |          .     |
00006050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00006070  20 20 20 52 55 53 53 49  41 0a 20 20 20 20 20 20  |   RUSSIA.      |
00006080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000060a0  20 20 31 31 35 35 34 31  0a 20 20 20 20 20 20 20  |  115541.       |
000060b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000060d0  20 4d 6f 73 63 6f 77 0a  20 20 20 20 20 20 20 20  | Moscow.        |
000060e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00006100  4b 61 76 6b 61 7a 73 6b  79 20 62 6f 75 6c 65 76  |Kavkazsky boulev|
00006110  61 72 64 2c 20 32 39 0a  20 20 20 20 20 20 20 20  |ard, 29.        |
00006120  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00006140  42 6c 64 2e 20 31 2c 20  46 6c 61 74 20 31 30 37  |Bld. 1, Flat 107|
00006150  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00006160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006170  20 20 20 20 20 20 20 20  20 41 6c 65 78 20 50 65  |         Alex Pe|
00006180  74 72 6f 76 20 20 20 20  0a 0a 20 20 20 20 20 20  |trov    ..      |
00006190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000061a0  20 20 20 45 2d 6d 61 69  6c 3a 20 41 50 65 74 72  |   E-mail: APetr|
000061b0  6f 76 40 6d 69 73 69 73  2e 6d 73 6b 2e 73 75 20  |ov@misis.msk.su |
000061c0  20 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | .              |
000061d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000061e0  20 20 20 41 50 65 74 72  6f 76 40 61 72 6d 2e 6d  |   APetrov@arm.m|
000061f0  73 6b 2e 73 75 0a 0a 20  20 20 20 20 20 20 20 20  |sk.su..         |
00006200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006210  46 49 44 4f 20 3a 20 20  32 3a 35 30 32 30 2f 31  |FIDO :  2:5020/1|
00006220  30 34 2e 31 33 0a 20 20  20 20 20 20 20 20 20 20  |04.13.          |
00006230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006240  20 20 20 20 20 20 20 0a  20 20 20 20 20 20 20 20  |       .        |
00006250  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006260  20 20 70 68 6f 6e 65 3a  20 2b 37 20 30 39 35 20  |  phone: +7 095 |
00006270  33 32 32 20 32 30 39 38  0a 20 20 20 20 20 20 20  |322 2098.       |
00006280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00006290  20 20 20 66 61 78 20 20  3a 20 2b 37 20 30 39 35  |   fax  : +7 095|
000062a0  20 32 33 36 20 38 33 35  30 0a 0a                 | 236 8350..|
000062ab