Home » Archimedes archive » Acorn Computing » 1994 08 subscription disc.adf » 9408s » Shareware/Event/Documents/!EShellDoc/StrongHlp/MenuUtils/HelpData

Shareware/Event/Documents/!EShellDoc/StrongHlp/MenuUtils/HelpData

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 » Acorn Computing » 1994 08 subscription disc.adf » 9408s
Filename: Shareware/Event/Documents/!EShellDoc/StrongHlp/MenuUtils/HelpData
Read OK:
File size: 80B0 bytes
Load address: 0000
Exec address: 0000
File contents
Introduction
This module is mainly intended for people who write RISC OS
applications in BBC BASIC. It can save programmer from the need to
write his own procedures in BASIC for handling menus. MenuUtils module
can perform all the work needed to create, edit, display and decode
menus. The module is very simple in use and is ideal for creating
simple menus. On the other hand module's advanced features allows
easily create and manipulate even very complex multi-level dynamic
menus.What does it do?
The MenuUtils module is not the extension to the Window Manager and it
doesn't provide any extra feature. The module only provides a
convenient interface for the programmer to Window Manager's menu
system. The module has a collection of SWIs to do all the low level
work concerned with direct accesses to menu data structures, memory
allocation, etc. It saves the author of application program from the
need to do this routine work himself.

MenuUtils provides mechanism of item handlers. It allows to attach
individual handler to each menu item. In case of BBC BASIC the handler
may be simply a BASIC function. When menu item is selected the
corresponding item handler may be invoked automatically. This feature
saves the programmer from the need to decode the list of menu
selections. During program development the use of individual item
handlers simplifies the process of menu modification. You can freely
rearrange menu items without the need to make any changes in other
parts of the program. There is an example in the end of this text
which illustrates the use of item handlers in BASIC programs.

MenuUtils automatically allocates memory to hold menu data structures.
And also it takes care about  appearance of menus on screen by forcing
them to be in standard RISC OS style.Technical Details
Module MenuUtils may be used only by programs which are WIMP tasks.
Special SWI MenuUtil_Initialise is provided to register the program as
MenuUtils client. MenuUtil_Initialise must be called after
Wimp_Initialise has been called and before any other call to MenuUtils
module is made.

All menus created by MenuUtils are kept in RMA. So you have no need to
reserve memory for them. On exit from your program all the memory will
be automatically returned to RMA.

Single MenuUtils module can handle menus for several WIMP tasks.

Internal format of menu data structures created by the module is the
same as described in RISC OS 2 PRM. So it is possible to combine menus
created by MenuUtils with other menus. To find out address of menu
data structure you can use SWI MenuUtil_Info.Menu Handles
Menu consists of menu title and one or more menu items. Each menu and
each menu item created with MenuUtils gets unique handle. You can use
this handle to refer to particular menu or menu item.

The use of unique handles for each menu item instead of absolute
addresses or positions in menu gives additional flexibility in
manipulation with menu data structure. It allows for example insert
and delete menu items.

MenuUtils always remembers the handle used in last operation. This
handle is called current handle and it will be used as default in the
next operation. This is especially convenient when calls to the module
are made from BASIC with SYS command.Menu Creation
To start new menu you must call MenuUtil_New. Then you may add to it
any number of menu items. To add new item you must call MenuUtil_Add.
Menu always is ready to be displayed on screen and you have no need to
specially inform the module when you have added the last item to the
menu.

By default all new items are added to the end of menu. If you want to
insert new item in the middle of menu then you must specify the handle
of the item before which you want to insert the new item.
                                
All menu flags in added items are cleared. Colours and dimensions are
in standard RISC OS style. Width of menu is adjusted automatically.

In order to construct multi-level menu tree you have to connect some
menu items with submenus or with dialog boxes. MenuUtils provides
special SWI to link menu item with submenu. This SWI also allows you
to link menus created by MenuUtils with other menus.Menu Modification
You can in any moment change menu title string as well as the text of
menu items. You can also change foreground and background colours of
menu items.
                                              
Menu item has a number of flags which control its appearance and
behaviour. The flags are tick, fade, dots, submenu, writable and
message. Special SWIs are provided to set or clear each menu flag. As
a special case when you are making menu item writable you can also
specify buffer size and optional validation string. 

You can delete single menu item or the whole menu with
MenuUtil_Delete. You can also recursively delete the whole menu
subtree connected with the deleted item or with the deleted menu.Displaying Menus On The Screen
According to RISC OS rules you must display menu on screen when user
clicks with Menu button over one of your windows or iconbar icon. To
find out where to display the menu you have to perform some
calculations. MenuUtils provides a SWI MenuUtil_Show which will
perform all necessary calculations for you and open menu in the right
screen position according to RISC OS standards.

Special SWI is provided to display submenu in reply to
Message_MenuWarning.Item Handlers And Menu Decoding
The mechanism of item handlers allows to link each menu item with
individual item handler. The handler may be invoked automatically and
you have no need to decode the list of selections in order to take the
appropriate action.

During the call to "MenuUtil_Initialise" you must specify
initialisation type. Initialisation type defines the interpretation of
item handlers and can be "BASIC" or "machine code" (latter is not
supported in current version). In case of "BASIC" the item handlers
are assumed to be the BASIC functions and in case of "machine code" -
ARM subroutines. If you want to attach a handler to menu item you must
pass the pointer to the name of BASIC function or respectively the
address of the ARM subroutine to MenuUtil_Add.

After user selection the corresponding item handler will be found by
"MenuUtil_Decode". To invoke the handler you have to call either the
BASIC function or the ARM subroutine depending on initialisation type.Other Features
Many applications use standard menu allowing user to select a colour
from standard desktop colours. MenuUtils provides a special SWI
"<MenuUtil_ColourMenu>" which creates such colour setting menu.Application Notes
This example illustrates the use of menu item handlers in programs in
BBC BASIC. Lets consider simple menu consisting of single item.

            +----------------+
            |                |
            |  Simple menu   |
            |                |
            +----------------+
            |  Item#1        |  
            +----------------+

To create this menu we must call "<MenuUtil_New>" and to add an item -
"<MenuUtil_Add>".

 SYS "MenuUtil_New",,"Simple menu"
 SYS "MenuUtil_Add",,"Item#1","func1"

- here "Simple menu" is menu title, "Item#1" - item text and "func1" -
name of the item handler. The name of the handler is "func1" so we
must have a function with the name "FNfunc1".

 DEF FNfunc1
 ...
 =TRUE

Then we organize the main Wimp_Poll loop in the following way.

 DIM q% &100
 REPEAT SYS "Wimp_Poll",,q% TO reason%
   CASE reason% OF
     ...         
     REM Mouse click
     WHEN 6
            IF q%!8=2 THEN SYS "<MenuUtil_Show>",,q%
 
     REM Menu selection  
     WHEN 9
            SYS "<MenuUtil_Decode>",,q% TO handler%
            IF handler% THEN
              handler$="FN"+$handler%   
              IF EVAL handler$
            ENDIF
     ...
   ENDCASE
 UNTIL FALSE
    
If the user clicks with Menu button we will call "<MenuUtil_Show>" to
display menu on screen. If user selects something from our menu we
will call "<MenuUtil_Decode>" to find out corresponding item handler.
Variable handler% will contain pointer to the handler name. In our
example if user will select item "Item#1" variable handler% will point
to string "func1". The full name of the handler will be
"FN"+$handler%. And EVAL statement is used to call it.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 8350MenuUtils module v.0.10
All SWIs are prefixed with 'MenuUtil_'.
Click <here=>Docs> for further documentation
and programming examples.

#Table 6 14
<Initialise =>MenuUtil_Initialise>    
<New        =>MenuUtil_New>           
<Add        =>MenuUtil_Add>           
<Delete     =>MenuUtil_Delete>  
<Decode     =>MenuUtil_Decode>
<Show       =>MenuUtil_Show>
<ShowSubMenu=>MenuUtil_ShowSubMenu>
<Info       =>MenuUtil_Info>
<Text       =>MenuUtil_Text>
<Tick       =>MenuUtil_Tick>
<Dots       =>MenuUtil_Dots>
<Fade       =>MenuUtil_Fade>
<Warning    =>MenuUtil_Warning>
<Writable   =>MenuUtil_Writable>
<SubMenu    =>MenuUtil_SubMenu>
<ColourMenu =>MenuUtil_ColourMenu>
<Colours    =>MenuUtil_Colours>
<TickOnly   =>MenuUtil_TickOnly>
#EndTableMenuUtils module v.0.10
<Introduction                   =>Intro>
<What does MenuUtils do ?       =>WhatDo>
<Technical details              =>TechDet>
<Menu handles                   =>MHandles>
<Menu creation                  =>MCreation>
<Menu modification              =>MModification>
<Displaying menu on screen      =>Displaying>
<Item handlers and menu decoding=>Handlers>
<Other features                 =>Features>
<Application notes              =>AppNotes>
<Notes from the author          =>Author>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...=>Ex_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...=>Ex_New>Example code (MenuUtil_New)
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%Example code (MenuUtil_Initialise)
Register the task with any version of the module

SYS "MenuUtil_Initialise"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...=>Ex_Add>Example code (MenuUtil_Add)
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%enuUtil_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...=>Ex_Delete>Example code (MenuUtil_Delete)
Delete item with handle tmpItem%:

  SYS "MenuUtil_Delete",tmpItem%

Recursively delete all menus linked with mainMenu%:
 
  SYS "MenuUtil_Delete",mainMenu%,TRUEMenuUtil_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
R2. Format of the returned block is as follows: 

 R2+0  position of selected menu item in menu (starting from 0)
 R2+4  pointer to selected item data
 R2+8  selected item handle or zero if item was created without MenuUtils
 R2+12 pointer to text string of selected item
 R2+16 position of parent menu item in menu (starting from 0)
 R2+20 pointer to parent item data
 R2+24 parent item handle or zero if item was created without MenuUtils
 R2+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 determined 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" (notsupported 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...=>Ex_Decode>Example code (MenuUtil_Decode)
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$)
  ENDIFExample code (MenuUtil_Show)
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_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...=>Ex_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...=>Ex_ShowSubMenu>Example code (MenuUtil_ShowSubMenu)
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...=>Ex_Text>Example code (MenuUtil_Text)
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$Example code (MenuUtil_Tick)
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_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...=>Ex_Tick>Example code (MenuUtil_Dots)
Display dotted line after the current menu item

  SYS "MenuUtil_Dots",,TRUEMenuUtil_Dots (SWI  &45BCA)
This call may be used to modify the state of menu flag which controls
the dotted line displayed below 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...=>Ex_Dots>Example code (MenuUtil_Fade)
Fade current menu item:

  SYS "MenuUtil_Fade",,TRUE

Fade all items in "Select" submenu with handle selectMenu%

  SYS "MenuUtil_Fade",selectMenu%,TRUEMenuUtil_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...=>Ex_Fade>Example code (MenuUtil_Warning)
Generate message when moving to the fonts submenu:

  SYS "MenuUtil_Warning",fontsItem%,TRUEMenuUtil_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...=>Ex_Warning>Example code (MenuUtil_Writable)
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_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...=>Ex_Writable>Example code (MenuUtil_Submenu)
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_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=>SWI.Wimp_CreateWindow>").

<Example code...=>Ex_Submenu>Example code (MenuUtil_ColourMenu)
Create colour setting menu:

  SYS "MenuUtil_ColourMenu",,"Colour" TO colourMenu%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...=>Ex_ColourMenu>Example code (MenuUtil_Colours)
Change colours of current item to black on yellow:

  SYS "MenuUtil_Colours",,7,9MenuUtil_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...=>Ex_Colours>Example code (MenuUtil_TickOnly)
Tick black colour in colour menu:

  SYS "MenuUtil_TickOnly",colourMenu%,7MenuUtil_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...=>Ex_TickOnly>
00000000  49 6e 74 72 6f 64 75 63  74 69 6f 6e 0a 54 68 69  |Introduction.Thi|
00000010  73 20 6d 6f 64 75 6c 65  20 69 73 20 6d 61 69 6e  |s module is main|
00000020  6c 79 20 69 6e 74 65 6e  64 65 64 20 66 6f 72 20  |ly intended for |
00000030  70 65 6f 70 6c 65 20 77  68 6f 20 77 72 69 74 65  |people who write|
00000040  20 52 49 53 43 20 4f 53  0a 61 70 70 6c 69 63 61  | RISC OS.applica|
00000050  74 69 6f 6e 73 20 69 6e  20 42 42 43 20 42 41 53  |tions in BBC BAS|
00000060  49 43 2e 20 49 74 20 63  61 6e 20 73 61 76 65 20  |IC. It can save |
00000070  70 72 6f 67 72 61 6d 6d  65 72 20 66 72 6f 6d 20  |programmer from |
00000080  74 68 65 20 6e 65 65 64  20 74 6f 0a 77 72 69 74  |the need to.writ|
00000090  65 20 68 69 73 20 6f 77  6e 20 70 72 6f 63 65 64  |e his own proced|
000000a0  75 72 65 73 20 69 6e 20  42 41 53 49 43 20 66 6f  |ures in BASIC fo|
000000b0  72 20 68 61 6e 64 6c 69  6e 67 20 6d 65 6e 75 73  |r handling menus|
000000c0  2e 20 4d 65 6e 75 55 74  69 6c 73 20 6d 6f 64 75  |. MenuUtils modu|
000000d0  6c 65 0a 63 61 6e 20 70  65 72 66 6f 72 6d 20 61  |le.can perform a|
000000e0  6c 6c 20 74 68 65 20 77  6f 72 6b 20 6e 65 65 64  |ll the work need|
000000f0  65 64 20 74 6f 20 63 72  65 61 74 65 2c 20 65 64  |ed to create, ed|
00000100  69 74 2c 20 64 69 73 70  6c 61 79 20 61 6e 64 20  |it, display and |
00000110  64 65 63 6f 64 65 0a 6d  65 6e 75 73 2e 20 54 68  |decode.menus. Th|
00000120  65 20 6d 6f 64 75 6c 65  20 69 73 20 76 65 72 79  |e module is very|
00000130  20 73 69 6d 70 6c 65 20  69 6e 20 75 73 65 20 61  | simple in use a|
00000140  6e 64 20 69 73 20 69 64  65 61 6c 20 66 6f 72 20  |nd is ideal for |
00000150  63 72 65 61 74 69 6e 67  0a 73 69 6d 70 6c 65 20  |creating.simple |
00000160  6d 65 6e 75 73 2e 20 4f  6e 20 74 68 65 20 6f 74  |menus. On the ot|
00000170  68 65 72 20 68 61 6e 64  20 6d 6f 64 75 6c 65 27  |her hand module'|
00000180  73 20 61 64 76 61 6e 63  65 64 20 66 65 61 74 75  |s advanced featu|
00000190  72 65 73 20 61 6c 6c 6f  77 73 0a 65 61 73 69 6c  |res allows.easil|
000001a0  79 20 63 72 65 61 74 65  20 61 6e 64 20 6d 61 6e  |y create and man|
000001b0  69 70 75 6c 61 74 65 20  65 76 65 6e 20 76 65 72  |ipulate even ver|
000001c0  79 20 63 6f 6d 70 6c 65  78 20 6d 75 6c 74 69 2d  |y complex multi-|
000001d0  6c 65 76 65 6c 20 64 79  6e 61 6d 69 63 0a 6d 65  |level dynamic.me|
000001e0  6e 75 73 2e 57 68 61 74  20 64 6f 65 73 20 69 74  |nus.What does it|
000001f0  20 64 6f 3f 0a 54 68 65  20 4d 65 6e 75 55 74 69  | do?.The MenuUti|
00000200  6c 73 20 6d 6f 64 75 6c  65 20 69 73 20 6e 6f 74  |ls module is not|
00000210  20 74 68 65 20 65 78 74  65 6e 73 69 6f 6e 20 74  | the extension t|
00000220  6f 20 74 68 65 20 57 69  6e 64 6f 77 20 4d 61 6e  |o the Window Man|
00000230  61 67 65 72 20 61 6e 64  20 69 74 0a 64 6f 65 73  |ager and it.does|
00000240  6e 27 74 20 70 72 6f 76  69 64 65 20 61 6e 79 20  |n't provide any |
00000250  65 78 74 72 61 20 66 65  61 74 75 72 65 2e 20 54  |extra feature. T|
00000260  68 65 20 6d 6f 64 75 6c  65 20 6f 6e 6c 79 20 70  |he module only p|
00000270  72 6f 76 69 64 65 73 20  61 0a 63 6f 6e 76 65 6e  |rovides a.conven|
00000280  69 65 6e 74 20 69 6e 74  65 72 66 61 63 65 20 66  |ient interface f|
00000290  6f 72 20 74 68 65 20 70  72 6f 67 72 61 6d 6d 65  |or the programme|
000002a0  72 20 74 6f 20 57 69 6e  64 6f 77 20 4d 61 6e 61  |r to Window Mana|
000002b0  67 65 72 27 73 20 6d 65  6e 75 0a 73 79 73 74 65  |ger's menu.syste|
000002c0  6d 2e 20 54 68 65 20 6d  6f 64 75 6c 65 20 68 61  |m. The module ha|
000002d0  73 20 61 20 63 6f 6c 6c  65 63 74 69 6f 6e 20 6f  |s a collection o|
000002e0  66 20 53 57 49 73 20 74  6f 20 64 6f 20 61 6c 6c  |f SWIs to do all|
000002f0  20 74 68 65 20 6c 6f 77  20 6c 65 76 65 6c 0a 77  | the low level.w|
00000300  6f 72 6b 20 63 6f 6e 63  65 72 6e 65 64 20 77 69  |ork concerned wi|
00000310  74 68 20 64 69 72 65 63  74 20 61 63 63 65 73 73  |th direct access|
00000320  65 73 20 74 6f 20 6d 65  6e 75 20 64 61 74 61 20  |es to menu data |
00000330  73 74 72 75 63 74 75 72  65 73 2c 20 6d 65 6d 6f  |structures, memo|
00000340  72 79 0a 61 6c 6c 6f 63  61 74 69 6f 6e 2c 20 65  |ry.allocation, e|
00000350  74 63 2e 20 49 74 20 73  61 76 65 73 20 74 68 65  |tc. It saves the|
00000360  20 61 75 74 68 6f 72 20  6f 66 20 61 70 70 6c 69  | author of appli|
00000370  63 61 74 69 6f 6e 20 70  72 6f 67 72 61 6d 20 66  |cation program f|
00000380  72 6f 6d 20 74 68 65 0a  6e 65 65 64 20 74 6f 20  |rom the.need to |
00000390  64 6f 20 74 68 69 73 20  72 6f 75 74 69 6e 65 20  |do this routine |
000003a0  77 6f 72 6b 20 68 69 6d  73 65 6c 66 2e 0a 0a 4d  |work himself...M|
000003b0  65 6e 75 55 74 69 6c 73  20 70 72 6f 76 69 64 65  |enuUtils provide|
000003c0  73 20 6d 65 63 68 61 6e  69 73 6d 20 6f 66 20 69  |s mechanism of i|
000003d0  74 65 6d 20 68 61 6e 64  6c 65 72 73 2e 20 49 74  |tem handlers. It|
000003e0  20 61 6c 6c 6f 77 73 20  74 6f 20 61 74 74 61 63  | allows to attac|
000003f0  68 0a 69 6e 64 69 76 69  64 75 61 6c 20 68 61 6e  |h.individual han|
00000400  64 6c 65 72 20 74 6f 20  65 61 63 68 20 6d 65 6e  |dler to each men|
00000410  75 20 69 74 65 6d 2e 20  49 6e 20 63 61 73 65 20  |u item. In case |
00000420  6f 66 20 42 42 43 20 42  41 53 49 43 20 74 68 65  |of BBC BASIC the|
00000430  20 68 61 6e 64 6c 65 72  0a 6d 61 79 20 62 65 20  | handler.may be |
00000440  73 69 6d 70 6c 79 20 61  20 42 41 53 49 43 20 66  |simply a BASIC f|
00000450  75 6e 63 74 69 6f 6e 2e  20 57 68 65 6e 20 6d 65  |unction. When me|
00000460  6e 75 20 69 74 65 6d 20  69 73 20 73 65 6c 65 63  |nu item is selec|
00000470  74 65 64 20 74 68 65 0a  63 6f 72 72 65 73 70 6f  |ted the.correspo|
00000480  6e 64 69 6e 67 20 69 74  65 6d 20 68 61 6e 64 6c  |nding item handl|
00000490  65 72 20 6d 61 79 20 62  65 20 69 6e 76 6f 6b 65  |er may be invoke|
000004a0  64 20 61 75 74 6f 6d 61  74 69 63 61 6c 6c 79 2e  |d automatically.|
000004b0  20 54 68 69 73 20 66 65  61 74 75 72 65 0a 73 61  | This feature.sa|
000004c0  76 65 73 20 74 68 65 20  70 72 6f 67 72 61 6d 6d  |ves the programm|
000004d0  65 72 20 66 72 6f 6d 20  74 68 65 20 6e 65 65 64  |er from the need|
000004e0  20 74 6f 20 64 65 63 6f  64 65 20 74 68 65 20 6c  | to decode the l|
000004f0  69 73 74 20 6f 66 20 6d  65 6e 75 0a 73 65 6c 65  |ist of menu.sele|
00000500  63 74 69 6f 6e 73 2e 20  44 75 72 69 6e 67 20 70  |ctions. During p|
00000510  72 6f 67 72 61 6d 20 64  65 76 65 6c 6f 70 6d 65  |rogram developme|
00000520  6e 74 20 74 68 65 20 75  73 65 20 6f 66 20 69 6e  |nt the use of in|
00000530  64 69 76 69 64 75 61 6c  20 69 74 65 6d 0a 68 61  |dividual item.ha|
00000540  6e 64 6c 65 72 73 20 73  69 6d 70 6c 69 66 69 65  |ndlers simplifie|
00000550  73 20 74 68 65 20 70 72  6f 63 65 73 73 20 6f 66  |s the process of|
00000560  20 6d 65 6e 75 20 6d 6f  64 69 66 69 63 61 74 69  | menu modificati|
00000570  6f 6e 2e 20 59 6f 75 20  63 61 6e 20 66 72 65 65  |on. You can free|
00000580  6c 79 0a 72 65 61 72 72  61 6e 67 65 20 6d 65 6e  |ly.rearrange men|
00000590  75 20 69 74 65 6d 73 20  77 69 74 68 6f 75 74 20  |u items without |
000005a0  74 68 65 20 6e 65 65 64  20 74 6f 20 6d 61 6b 65  |the need to make|
000005b0  20 61 6e 79 20 63 68 61  6e 67 65 73 20 69 6e 20  | any changes in |
000005c0  6f 74 68 65 72 0a 70 61  72 74 73 20 6f 66 20 74  |other.parts of t|
000005d0  68 65 20 70 72 6f 67 72  61 6d 2e 20 54 68 65 72  |he program. Ther|
000005e0  65 20 69 73 20 61 6e 20  65 78 61 6d 70 6c 65 20  |e is an example |
000005f0  69 6e 20 74 68 65 20 65  6e 64 20 6f 66 20 74 68  |in the end of th|
00000600  69 73 20 74 65 78 74 0a  77 68 69 63 68 20 69 6c  |is text.which il|
00000610  6c 75 73 74 72 61 74 65  73 20 74 68 65 20 75 73  |lustrates the us|
00000620  65 20 6f 66 20 69 74 65  6d 20 68 61 6e 64 6c 65  |e of item handle|
00000630  72 73 20 69 6e 20 42 41  53 49 43 20 70 72 6f 67  |rs in BASIC prog|
00000640  72 61 6d 73 2e 0a 0a 4d  65 6e 75 55 74 69 6c 73  |rams...MenuUtils|
00000650  20 61 75 74 6f 6d 61 74  69 63 61 6c 6c 79 20 61  | automatically a|
00000660  6c 6c 6f 63 61 74 65 73  20 6d 65 6d 6f 72 79 20  |llocates memory |
00000670  74 6f 20 68 6f 6c 64 20  6d 65 6e 75 20 64 61 74  |to hold menu dat|
00000680  61 20 73 74 72 75 63 74  75 72 65 73 2e 0a 41 6e  |a structures..An|
00000690  64 20 61 6c 73 6f 20 69  74 20 74 61 6b 65 73 20  |d also it takes |
000006a0  63 61 72 65 20 61 62 6f  75 74 20 20 61 70 70 65  |care about  appe|
000006b0  61 72 61 6e 63 65 20 6f  66 20 6d 65 6e 75 73 20  |arance of menus |
000006c0  6f 6e 20 73 63 72 65 65  6e 20 62 79 20 66 6f 72  |on screen by for|
000006d0  63 69 6e 67 0a 74 68 65  6d 20 74 6f 20 62 65 20  |cing.them to be |
000006e0  69 6e 20 73 74 61 6e 64  61 72 64 20 52 49 53 43  |in standard RISC|
000006f0  20 4f 53 20 73 74 79 6c  65 2e 54 65 63 68 6e 69  | OS style.Techni|
00000700  63 61 6c 20 44 65 74 61  69 6c 73 0a 4d 6f 64 75  |cal Details.Modu|
00000710  6c 65 20 4d 65 6e 75 55  74 69 6c 73 20 6d 61 79  |le MenuUtils may|
00000720  20 62 65 20 75 73 65 64  20 6f 6e 6c 79 20 62 79  | be used only by|
00000730  20 70 72 6f 67 72 61 6d  73 20 77 68 69 63 68 20  | programs which |
00000740  61 72 65 20 57 49 4d 50  20 74 61 73 6b 73 2e 0a  |are WIMP tasks..|
00000750  53 70 65 63 69 61 6c 20  53 57 49 20 4d 65 6e 75  |Special SWI Menu|
00000760  55 74 69 6c 5f 49 6e 69  74 69 61 6c 69 73 65 20  |Util_Initialise |
00000770  69 73 20 70 72 6f 76 69  64 65 64 20 74 6f 20 72  |is provided to r|
00000780  65 67 69 73 74 65 72 20  74 68 65 20 70 72 6f 67  |egister the prog|
00000790  72 61 6d 20 61 73 0a 4d  65 6e 75 55 74 69 6c 73  |ram as.MenuUtils|
000007a0  20 63 6c 69 65 6e 74 2e  20 4d 65 6e 75 55 74 69  | client. MenuUti|
000007b0  6c 5f 49 6e 69 74 69 61  6c 69 73 65 20 6d 75 73  |l_Initialise mus|
000007c0  74 20 62 65 20 63 61 6c  6c 65 64 20 61 66 74 65  |t be called afte|
000007d0  72 0a 57 69 6d 70 5f 49  6e 69 74 69 61 6c 69 73  |r.Wimp_Initialis|
000007e0  65 20 68 61 73 20 62 65  65 6e 20 63 61 6c 6c 65  |e has been calle|
000007f0  64 20 61 6e 64 20 62 65  66 6f 72 65 20 61 6e 79  |d and before any|
00000800  20 6f 74 68 65 72 20 63  61 6c 6c 20 74 6f 20 4d  | other call to M|
00000810  65 6e 75 55 74 69 6c 73  0a 6d 6f 64 75 6c 65 20  |enuUtils.module |
00000820  69 73 20 6d 61 64 65 2e  0a 0a 41 6c 6c 20 6d 65  |is made...All me|
00000830  6e 75 73 20 63 72 65 61  74 65 64 20 62 79 20 4d  |nus created by M|
00000840  65 6e 75 55 74 69 6c 73  20 61 72 65 20 6b 65 70  |enuUtils are kep|
00000850  74 20 69 6e 20 52 4d 41  2e 20 53 6f 20 79 6f 75  |t in RMA. So you|
00000860  20 68 61 76 65 20 6e 6f  20 6e 65 65 64 20 74 6f  | have no need to|
00000870  0a 72 65 73 65 72 76 65  20 6d 65 6d 6f 72 79 20  |.reserve memory |
00000880  66 6f 72 20 74 68 65 6d  2e 20 4f 6e 20 65 78 69  |for them. On exi|
00000890  74 20 66 72 6f 6d 20 79  6f 75 72 20 70 72 6f 67  |t from your prog|
000008a0  72 61 6d 20 61 6c 6c 20  74 68 65 20 6d 65 6d 6f  |ram all the memo|
000008b0  72 79 20 77 69 6c 6c 0a  62 65 20 61 75 74 6f 6d  |ry will.be autom|
000008c0  61 74 69 63 61 6c 6c 79  20 72 65 74 75 72 6e 65  |atically returne|
000008d0  64 20 74 6f 20 52 4d 41  2e 0a 0a 53 69 6e 67 6c  |d to RMA...Singl|
000008e0  65 20 4d 65 6e 75 55 74  69 6c 73 20 6d 6f 64 75  |e MenuUtils modu|
000008f0  6c 65 20 63 61 6e 20 68  61 6e 64 6c 65 20 6d 65  |le can handle me|
00000900  6e 75 73 20 66 6f 72 20  73 65 76 65 72 61 6c 20  |nus for several |
00000910  57 49 4d 50 20 74 61 73  6b 73 2e 0a 0a 49 6e 74  |WIMP tasks...Int|
00000920  65 72 6e 61 6c 20 66 6f  72 6d 61 74 20 6f 66 20  |ernal format of |
00000930  6d 65 6e 75 20 64 61 74  61 20 73 74 72 75 63 74  |menu data struct|
00000940  75 72 65 73 20 63 72 65  61 74 65 64 20 62 79 20  |ures created by |
00000950  74 68 65 20 6d 6f 64 75  6c 65 20 69 73 20 74 68  |the module is th|
00000960  65 0a 73 61 6d 65 20 61  73 20 64 65 73 63 72 69  |e.same as descri|
00000970  62 65 64 20 69 6e 20 52  49 53 43 20 4f 53 20 32  |bed in RISC OS 2|
00000980  20 50 52 4d 2e 20 53 6f  20 69 74 20 69 73 20 70  | PRM. So it is p|
00000990  6f 73 73 69 62 6c 65 20  74 6f 20 63 6f 6d 62 69  |ossible to combi|
000009a0  6e 65 20 6d 65 6e 75 73  0a 63 72 65 61 74 65 64  |ne menus.created|
000009b0  20 62 79 20 4d 65 6e 75  55 74 69 6c 73 20 77 69  | by MenuUtils wi|
000009c0  74 68 20 6f 74 68 65 72  20 6d 65 6e 75 73 2e 20  |th other menus. |
000009d0  54 6f 20 66 69 6e 64 20  6f 75 74 20 61 64 64 72  |To find out addr|
000009e0  65 73 73 20 6f 66 20 6d  65 6e 75 0a 64 61 74 61  |ess of menu.data|
000009f0  20 73 74 72 75 63 74 75  72 65 20 79 6f 75 20 63  | structure you c|
00000a00  61 6e 20 75 73 65 20 53  57 49 20 4d 65 6e 75 55  |an use SWI MenuU|
00000a10  74 69 6c 5f 49 6e 66 6f  2e 4d 65 6e 75 20 48 61  |til_Info.Menu Ha|
00000a20  6e 64 6c 65 73 0a 4d 65  6e 75 20 63 6f 6e 73 69  |ndles.Menu consi|
00000a30  73 74 73 20 6f 66 20 6d  65 6e 75 20 74 69 74 6c  |sts of menu titl|
00000a40  65 20 61 6e 64 20 6f 6e  65 20 6f 72 20 6d 6f 72  |e and one or mor|
00000a50  65 20 6d 65 6e 75 20 69  74 65 6d 73 2e 20 45 61  |e menu items. Ea|
00000a60  63 68 20 6d 65 6e 75 20  61 6e 64 0a 65 61 63 68  |ch menu and.each|
00000a70  20 6d 65 6e 75 20 69 74  65 6d 20 63 72 65 61 74  | menu item creat|
00000a80  65 64 20 77 69 74 68 20  4d 65 6e 75 55 74 69 6c  |ed with MenuUtil|
00000a90  73 20 67 65 74 73 20 75  6e 69 71 75 65 20 68 61  |s gets unique ha|
00000aa0  6e 64 6c 65 2e 20 59 6f  75 20 63 61 6e 20 75 73  |ndle. You can us|
00000ab0  65 0a 74 68 69 73 20 68  61 6e 64 6c 65 20 74 6f  |e.this handle to|
00000ac0  20 72 65 66 65 72 20 74  6f 20 70 61 72 74 69 63  | refer to partic|
00000ad0  75 6c 61 72 20 6d 65 6e  75 20 6f 72 20 6d 65 6e  |ular menu or men|
00000ae0  75 20 69 74 65 6d 2e 0a  0a 54 68 65 20 75 73 65  |u item...The use|
00000af0  20 6f 66 20 75 6e 69 71  75 65 20 68 61 6e 64 6c  | of unique handl|
00000b00  65 73 20 66 6f 72 20 65  61 63 68 20 6d 65 6e 75  |es for each menu|
00000b10  20 69 74 65 6d 20 69 6e  73 74 65 61 64 20 6f 66  | item instead of|
00000b20  20 61 62 73 6f 6c 75 74  65 0a 61 64 64 72 65 73  | absolute.addres|
00000b30  73 65 73 20 6f 72 20 70  6f 73 69 74 69 6f 6e 73  |ses or positions|
00000b40  20 69 6e 20 6d 65 6e 75  20 67 69 76 65 73 20 61  | in menu gives a|
00000b50  64 64 69 74 69 6f 6e 61  6c 20 66 6c 65 78 69 62  |dditional flexib|
00000b60  69 6c 69 74 79 20 69 6e  0a 6d 61 6e 69 70 75 6c  |ility in.manipul|
00000b70  61 74 69 6f 6e 20 77 69  74 68 20 6d 65 6e 75 20  |ation with menu |
00000b80  64 61 74 61 20 73 74 72  75 63 74 75 72 65 2e 20  |data structure. |
00000b90  49 74 20 61 6c 6c 6f 77  73 20 66 6f 72 20 65 78  |It allows for ex|
00000ba0  61 6d 70 6c 65 20 69 6e  73 65 72 74 0a 61 6e 64  |ample insert.and|
00000bb0  20 64 65 6c 65 74 65 20  6d 65 6e 75 20 69 74 65  | delete menu ite|
00000bc0  6d 73 2e 0a 0a 4d 65 6e  75 55 74 69 6c 73 20 61  |ms...MenuUtils a|
00000bd0  6c 77 61 79 73 20 72 65  6d 65 6d 62 65 72 73 20  |lways remembers |
00000be0  74 68 65 20 68 61 6e 64  6c 65 20 75 73 65 64 20  |the handle used |
00000bf0  69 6e 20 6c 61 73 74 20  6f 70 65 72 61 74 69 6f  |in last operatio|
00000c00  6e 2e 20 54 68 69 73 0a  68 61 6e 64 6c 65 20 69  |n. This.handle i|
00000c10  73 20 63 61 6c 6c 65 64  20 63 75 72 72 65 6e 74  |s called current|
00000c20  20 68 61 6e 64 6c 65 20  61 6e 64 20 69 74 20 77  | handle and it w|
00000c30  69 6c 6c 20 62 65 20 75  73 65 64 20 61 73 20 64  |ill be used as d|
00000c40  65 66 61 75 6c 74 20 69  6e 20 74 68 65 0a 6e 65  |efault in the.ne|
00000c50  78 74 20 6f 70 65 72 61  74 69 6f 6e 2e 20 54 68  |xt operation. Th|
00000c60  69 73 20 69 73 20 65 73  70 65 63 69 61 6c 6c 79  |is is especially|
00000c70  20 63 6f 6e 76 65 6e 69  65 6e 74 20 77 68 65 6e  | convenient when|
00000c80  20 63 61 6c 6c 73 20 74  6f 20 74 68 65 20 6d 6f  | calls to the mo|
00000c90  64 75 6c 65 0a 61 72 65  20 6d 61 64 65 20 66 72  |dule.are made fr|
00000ca0  6f 6d 20 42 41 53 49 43  20 77 69 74 68 20 53 59  |om BASIC with SY|
00000cb0  53 20 63 6f 6d 6d 61 6e  64 2e 4d 65 6e 75 20 43  |S command.Menu C|
00000cc0  72 65 61 74 69 6f 6e 0a  54 6f 20 73 74 61 72 74  |reation.To start|
00000cd0  20 6e 65 77 20 6d 65 6e  75 20 79 6f 75 20 6d 75  | new menu you mu|
00000ce0  73 74 20 63 61 6c 6c 20  4d 65 6e 75 55 74 69 6c  |st call MenuUtil|
00000cf0  5f 4e 65 77 2e 20 54 68  65 6e 20 79 6f 75 20 6d  |_New. Then you m|
00000d00  61 79 20 61 64 64 20 74  6f 20 69 74 0a 61 6e 79  |ay add to it.any|
00000d10  20 6e 75 6d 62 65 72 20  6f 66 20 6d 65 6e 75 20  | number of menu |
00000d20  69 74 65 6d 73 2e 20 54  6f 20 61 64 64 20 6e 65  |items. To add ne|
00000d30  77 20 69 74 65 6d 20 79  6f 75 20 6d 75 73 74 20  |w item you must |
00000d40  63 61 6c 6c 20 4d 65 6e  75 55 74 69 6c 5f 41 64  |call MenuUtil_Ad|
00000d50  64 2e 0a 4d 65 6e 75 20  61 6c 77 61 79 73 20 69  |d..Menu always i|
00000d60  73 20 72 65 61 64 79 20  74 6f 20 62 65 20 64 69  |s ready to be di|
00000d70  73 70 6c 61 79 65 64 20  6f 6e 20 73 63 72 65 65  |splayed on scree|
00000d80  6e 20 61 6e 64 20 79 6f  75 20 68 61 76 65 20 6e  |n and you have n|
00000d90  6f 20 6e 65 65 64 20 74  6f 0a 73 70 65 63 69 61  |o need to.specia|
00000da0  6c 6c 79 20 69 6e 66 6f  72 6d 20 74 68 65 20 6d  |lly inform the m|
00000db0  6f 64 75 6c 65 20 77 68  65 6e 20 79 6f 75 20 68  |odule when you h|
00000dc0  61 76 65 20 61 64 64 65  64 20 74 68 65 20 6c 61  |ave added the la|
00000dd0  73 74 20 69 74 65 6d 20  74 6f 20 74 68 65 0a 6d  |st item to the.m|
00000de0  65 6e 75 2e 0a 0a 42 79  20 64 65 66 61 75 6c 74  |enu...By default|
00000df0  20 61 6c 6c 20 6e 65 77  20 69 74 65 6d 73 20 61  | all new items a|
00000e00  72 65 20 61 64 64 65 64  20 74 6f 20 74 68 65 20  |re added to the |
00000e10  65 6e 64 20 6f 66 20 6d  65 6e 75 2e 20 49 66 20  |end of menu. If |
00000e20  79 6f 75 20 77 61 6e 74  20 74 6f 0a 69 6e 73 65  |you want to.inse|
00000e30  72 74 20 6e 65 77 20 69  74 65 6d 20 69 6e 20 74  |rt new item in t|
00000e40  68 65 20 6d 69 64 64 6c  65 20 6f 66 20 6d 65 6e  |he middle of men|
00000e50  75 20 74 68 65 6e 20 79  6f 75 20 6d 75 73 74 20  |u then you must |
00000e60  73 70 65 63 69 66 79 20  74 68 65 20 68 61 6e 64  |specify the hand|
00000e70  6c 65 0a 6f 66 20 74 68  65 20 69 74 65 6d 20 62  |le.of the item b|
00000e80  65 66 6f 72 65 20 77 68  69 63 68 20 79 6f 75 20  |efore which you |
00000e90  77 61 6e 74 20 74 6f 20  69 6e 73 65 72 74 20 74  |want to insert t|
00000ea0  68 65 20 6e 65 77 20 69  74 65 6d 2e 0a 20 20 20  |he new item..   |
00000eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ec0  20 20 20 20 20 20 20 20  20 20 20 20 20 0a 41 6c  |             .Al|
00000ed0  6c 20 6d 65 6e 75 20 66  6c 61 67 73 20 69 6e 20  |l menu flags in |
00000ee0  61 64 64 65 64 20 69 74  65 6d 73 20 61 72 65 20  |added items are |
00000ef0  63 6c 65 61 72 65 64 2e  20 43 6f 6c 6f 75 72 73  |cleared. Colours|
00000f00  20 61 6e 64 20 64 69 6d  65 6e 73 69 6f 6e 73 20  | and dimensions |
00000f10  61 72 65 0a 69 6e 20 73  74 61 6e 64 61 72 64 20  |are.in standard |
00000f20  52 49 53 43 20 4f 53 20  73 74 79 6c 65 2e 20 57  |RISC OS style. W|
00000f30  69 64 74 68 20 6f 66 20  6d 65 6e 75 20 69 73 20  |idth of menu is |
00000f40  61 64 6a 75 73 74 65 64  20 61 75 74 6f 6d 61 74  |adjusted automat|
00000f50  69 63 61 6c 6c 79 2e 0a  0a 49 6e 20 6f 72 64 65  |ically...In orde|
00000f60  72 20 74 6f 20 63 6f 6e  73 74 72 75 63 74 20 6d  |r to construct m|
00000f70  75 6c 74 69 2d 6c 65 76  65 6c 20 6d 65 6e 75 20  |ulti-level menu |
00000f80  74 72 65 65 20 79 6f 75  20 68 61 76 65 20 74 6f  |tree you have to|
00000f90  20 63 6f 6e 6e 65 63 74  20 73 6f 6d 65 0a 6d 65  | connect some.me|
00000fa0  6e 75 20 69 74 65 6d 73  20 77 69 74 68 20 73 75  |nu items with su|
00000fb0  62 6d 65 6e 75 73 20 6f  72 20 77 69 74 68 20 64  |bmenus or with d|
00000fc0  69 61 6c 6f 67 20 62 6f  78 65 73 2e 20 4d 65 6e  |ialog boxes. Men|
00000fd0  75 55 74 69 6c 73 20 70  72 6f 76 69 64 65 73 0a  |uUtils provides.|
00000fe0  73 70 65 63 69 61 6c 20  53 57 49 20 74 6f 20 6c  |special SWI to l|
00000ff0  69 6e 6b 20 6d 65 6e 75  20 69 74 65 6d 20 77 69  |ink menu item wi|
00001000  74 68 20 73 75 62 6d 65  6e 75 2e 20 54 68 69 73  |th submenu. This|
00001010  20 53 57 49 20 61 6c 73  6f 20 61 6c 6c 6f 77 73  | SWI also allows|
00001020  20 79 6f 75 0a 74 6f 20  6c 69 6e 6b 20 6d 65 6e  | you.to link men|
00001030  75 73 20 63 72 65 61 74  65 64 20 62 79 20 4d 65  |us created by Me|
00001040  6e 75 55 74 69 6c 73 20  77 69 74 68 20 6f 74 68  |nuUtils with oth|
00001050  65 72 20 6d 65 6e 75 73  2e 4d 65 6e 75 20 4d 6f  |er menus.Menu Mo|
00001060  64 69 66 69 63 61 74 69  6f 6e 0a 59 6f 75 20 63  |dification.You c|
00001070  61 6e 20 69 6e 20 61 6e  79 20 6d 6f 6d 65 6e 74  |an in any moment|
00001080  20 63 68 61 6e 67 65 20  6d 65 6e 75 20 74 69 74  | change menu tit|
00001090  6c 65 20 73 74 72 69 6e  67 20 61 73 20 77 65 6c  |le string as wel|
000010a0  6c 20 61 73 20 74 68 65  20 74 65 78 74 20 6f 66  |l as the text of|
000010b0  0a 6d 65 6e 75 20 69 74  65 6d 73 2e 20 59 6f 75  |.menu items. You|
000010c0  20 63 61 6e 20 61 6c 73  6f 20 63 68 61 6e 67 65  | can also change|
000010d0  20 66 6f 72 65 67 72 6f  75 6e 64 20 61 6e 64 20  | foreground and |
000010e0  62 61 63 6b 67 72 6f 75  6e 64 20 63 6f 6c 6f 75  |background colou|
000010f0  72 73 20 6f 66 0a 6d 65  6e 75 20 69 74 65 6d 73  |rs of.menu items|
00001100  2e 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |..              |
00001110  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00001130  0a 4d 65 6e 75 20 69 74  65 6d 20 68 61 73 20 61  |.Menu item has a|
00001140  20 6e 75 6d 62 65 72 20  6f 66 20 66 6c 61 67 73  | number of flags|
00001150  20 77 68 69 63 68 20 63  6f 6e 74 72 6f 6c 20 69  | which control i|
00001160  74 73 20 61 70 70 65 61  72 61 6e 63 65 20 61 6e  |ts appearance an|
00001170  64 0a 62 65 68 61 76 69  6f 75 72 2e 20 54 68 65  |d.behaviour. The|
00001180  20 66 6c 61 67 73 20 61  72 65 20 74 69 63 6b 2c  | flags are tick,|
00001190  20 66 61 64 65 2c 20 64  6f 74 73 2c 20 73 75 62  | fade, dots, sub|
000011a0  6d 65 6e 75 2c 20 77 72  69 74 61 62 6c 65 20 61  |menu, writable a|
000011b0  6e 64 0a 6d 65 73 73 61  67 65 2e 20 53 70 65 63  |nd.message. Spec|
000011c0  69 61 6c 20 53 57 49 73  20 61 72 65 20 70 72 6f  |ial SWIs are pro|
000011d0  76 69 64 65 64 20 74 6f  20 73 65 74 20 6f 72 20  |vided to set or |
000011e0  63 6c 65 61 72 20 65 61  63 68 20 6d 65 6e 75 20  |clear each menu |
000011f0  66 6c 61 67 2e 20 41 73  0a 61 20 73 70 65 63 69  |flag. As.a speci|
00001200  61 6c 20 63 61 73 65 20  77 68 65 6e 20 79 6f 75  |al case when you|
00001210  20 61 72 65 20 6d 61 6b  69 6e 67 20 6d 65 6e 75  | are making menu|
00001220  20 69 74 65 6d 20 77 72  69 74 61 62 6c 65 20 79  | item writable y|
00001230  6f 75 20 63 61 6e 20 61  6c 73 6f 0a 73 70 65 63  |ou can also.spec|
00001240  69 66 79 20 62 75 66 66  65 72 20 73 69 7a 65 20  |ify buffer size |
00001250  61 6e 64 20 6f 70 74 69  6f 6e 61 6c 20 76 61 6c  |and optional val|
00001260  69 64 61 74 69 6f 6e 20  73 74 72 69 6e 67 2e 20  |idation string. |
00001270  0a 0a 59 6f 75 20 63 61  6e 20 64 65 6c 65 74 65  |..You can delete|
00001280  20 73 69 6e 67 6c 65 20  6d 65 6e 75 20 69 74 65  | single menu ite|
00001290  6d 20 6f 72 20 74 68 65  20 77 68 6f 6c 65 20 6d  |m or the whole m|
000012a0  65 6e 75 20 77 69 74 68  0a 4d 65 6e 75 55 74 69  |enu with.MenuUti|
000012b0  6c 5f 44 65 6c 65 74 65  2e 20 59 6f 75 20 63 61  |l_Delete. You ca|
000012c0  6e 20 61 6c 73 6f 20 72  65 63 75 72 73 69 76 65  |n also recursive|
000012d0  6c 79 20 64 65 6c 65 74  65 20 74 68 65 20 77 68  |ly delete the wh|
000012e0  6f 6c 65 20 6d 65 6e 75  0a 73 75 62 74 72 65 65  |ole menu.subtree|
000012f0  20 63 6f 6e 6e 65 63 74  65 64 20 77 69 74 68 20  | connected with |
00001300  74 68 65 20 64 65 6c 65  74 65 64 20 69 74 65 6d  |the deleted item|
00001310  20 6f 72 20 77 69 74 68  20 74 68 65 20 64 65 6c  | or with the del|
00001320  65 74 65 64 20 6d 65 6e  75 2e 44 69 73 70 6c 61  |eted menu.Displa|
00001330  79 69 6e 67 20 4d 65 6e  75 73 20 4f 6e 20 54 68  |ying Menus On Th|
00001340  65 20 53 63 72 65 65 6e  0a 41 63 63 6f 72 64 69  |e Screen.Accordi|
00001350  6e 67 20 74 6f 20 52 49  53 43 20 4f 53 20 72 75  |ng to RISC OS ru|
00001360  6c 65 73 20 79 6f 75 20  6d 75 73 74 20 64 69 73  |les you must dis|
00001370  70 6c 61 79 20 6d 65 6e  75 20 6f 6e 20 73 63 72  |play menu on scr|
00001380  65 65 6e 20 77 68 65 6e  20 75 73 65 72 0a 63 6c  |een when user.cl|
00001390  69 63 6b 73 20 77 69 74  68 20 4d 65 6e 75 20 62  |icks with Menu b|
000013a0  75 74 74 6f 6e 20 6f 76  65 72 20 6f 6e 65 20 6f  |utton over one o|
000013b0  66 20 79 6f 75 72 20 77  69 6e 64 6f 77 73 20 6f  |f your windows o|
000013c0  72 20 69 63 6f 6e 62 61  72 20 69 63 6f 6e 2e 20  |r iconbar icon. |
000013d0  54 6f 0a 66 69 6e 64 20  6f 75 74 20 77 68 65 72  |To.find out wher|
000013e0  65 20 74 6f 20 64 69 73  70 6c 61 79 20 74 68 65  |e to display the|
000013f0  20 6d 65 6e 75 20 79 6f  75 20 68 61 76 65 20 74  | menu you have t|
00001400  6f 20 70 65 72 66 6f 72  6d 20 73 6f 6d 65 0a 63  |o perform some.c|
00001410  61 6c 63 75 6c 61 74 69  6f 6e 73 2e 20 4d 65 6e  |alculations. Men|
00001420  75 55 74 69 6c 73 20 70  72 6f 76 69 64 65 73 20  |uUtils provides |
00001430  61 20 53 57 49 20 4d 65  6e 75 55 74 69 6c 5f 53  |a SWI MenuUtil_S|
00001440  68 6f 77 20 77 68 69 63  68 20 77 69 6c 6c 0a 70  |how which will.p|
00001450  65 72 66 6f 72 6d 20 61  6c 6c 20 6e 65 63 65 73  |erform all neces|
00001460  73 61 72 79 20 63 61 6c  63 75 6c 61 74 69 6f 6e  |sary calculation|
00001470  73 20 66 6f 72 20 79 6f  75 20 61 6e 64 20 6f 70  |s for you and op|
00001480  65 6e 20 6d 65 6e 75 20  69 6e 20 74 68 65 20 72  |en menu in the r|
00001490  69 67 68 74 0a 73 63 72  65 65 6e 20 70 6f 73 69  |ight.screen posi|
000014a0  74 69 6f 6e 20 61 63 63  6f 72 64 69 6e 67 20 74  |tion according t|
000014b0  6f 20 52 49 53 43 20 4f  53 20 73 74 61 6e 64 61  |o RISC OS standa|
000014c0  72 64 73 2e 0a 0a 53 70  65 63 69 61 6c 20 53 57  |rds...Special SW|
000014d0  49 20 69 73 20 70 72 6f  76 69 64 65 64 20 74 6f  |I is provided to|
000014e0  20 64 69 73 70 6c 61 79  20 73 75 62 6d 65 6e 75  | display submenu|
000014f0  20 69 6e 20 72 65 70 6c  79 20 74 6f 0a 4d 65 73  | in reply to.Mes|
00001500  73 61 67 65 5f 4d 65 6e  75 57 61 72 6e 69 6e 67  |sage_MenuWarning|
00001510  2e 49 74 65 6d 20 48 61  6e 64 6c 65 72 73 20 41  |.Item Handlers A|
00001520  6e 64 20 4d 65 6e 75 20  44 65 63 6f 64 69 6e 67  |nd Menu Decoding|
00001530  0a 54 68 65 20 6d 65 63  68 61 6e 69 73 6d 20 6f  |.The mechanism o|
00001540  66 20 69 74 65 6d 20 68  61 6e 64 6c 65 72 73 20  |f item handlers |
00001550  61 6c 6c 6f 77 73 20 74  6f 20 6c 69 6e 6b 20 65  |allows to link e|
00001560  61 63 68 20 6d 65 6e 75  20 69 74 65 6d 20 77 69  |ach menu item wi|
00001570  74 68 0a 69 6e 64 69 76  69 64 75 61 6c 20 69 74  |th.individual it|
00001580  65 6d 20 68 61 6e 64 6c  65 72 2e 20 54 68 65 20  |em handler. The |
00001590  68 61 6e 64 6c 65 72 20  6d 61 79 20 62 65 20 69  |handler may be i|
000015a0  6e 76 6f 6b 65 64 20 61  75 74 6f 6d 61 74 69 63  |nvoked automatic|
000015b0  61 6c 6c 79 20 61 6e 64  0a 79 6f 75 20 68 61 76  |ally and.you hav|
000015c0  65 20 6e 6f 20 6e 65 65  64 20 74 6f 20 64 65 63  |e no need to dec|
000015d0  6f 64 65 20 74 68 65 20  6c 69 73 74 20 6f 66 20  |ode the list of |
000015e0  73 65 6c 65 63 74 69 6f  6e 73 20 69 6e 20 6f 72  |selections in or|
000015f0  64 65 72 20 74 6f 20 74  61 6b 65 20 74 68 65 0a  |der to take the.|
00001600  61 70 70 72 6f 70 72 69  61 74 65 20 61 63 74 69  |appropriate acti|
00001610  6f 6e 2e 0a 0a 44 75 72  69 6e 67 20 74 68 65 20  |on...During the |
00001620  63 61 6c 6c 20 74 6f 20  22 4d 65 6e 75 55 74 69  |call to "MenuUti|
00001630  6c 5f 49 6e 69 74 69 61  6c 69 73 65 22 20 79 6f  |l_Initialise" yo|
00001640  75 20 6d 75 73 74 20 73  70 65 63 69 66 79 0a 69  |u must specify.i|
00001650  6e 69 74 69 61 6c 69 73  61 74 69 6f 6e 20 74 79  |nitialisation ty|
00001660  70 65 2e 20 49 6e 69 74  69 61 6c 69 73 61 74 69  |pe. Initialisati|
00001670  6f 6e 20 74 79 70 65 20  64 65 66 69 6e 65 73 20  |on type defines |
00001680  74 68 65 20 69 6e 74 65  72 70 72 65 74 61 74 69  |the interpretati|
00001690  6f 6e 20 6f 66 0a 69 74  65 6d 20 68 61 6e 64 6c  |on of.item handl|
000016a0  65 72 73 20 61 6e 64 20  63 61 6e 20 62 65 20 22  |ers and can be "|
000016b0  42 41 53 49 43 22 20 6f  72 20 22 6d 61 63 68 69  |BASIC" or "machi|
000016c0  6e 65 20 63 6f 64 65 22  20 28 6c 61 74 74 65 72  |ne code" (latter|
000016d0  20 69 73 20 6e 6f 74 0a  73 75 70 70 6f 72 74 65  | is not.supporte|
000016e0  64 20 69 6e 20 63 75 72  72 65 6e 74 20 76 65 72  |d in current ver|
000016f0  73 69 6f 6e 29 2e 20 49  6e 20 63 61 73 65 20 6f  |sion). In case o|
00001700  66 20 22 42 41 53 49 43  22 20 74 68 65 20 69 74  |f "BASIC" the it|
00001710  65 6d 20 68 61 6e 64 6c  65 72 73 0a 61 72 65 20  |em handlers.are |
00001720  61 73 73 75 6d 65 64 20  74 6f 20 62 65 20 74 68  |assumed to be th|
00001730  65 20 42 41 53 49 43 20  66 75 6e 63 74 69 6f 6e  |e BASIC function|
00001740  73 20 61 6e 64 20 69 6e  20 63 61 73 65 20 6f 66  |s and in case of|
00001750  20 22 6d 61 63 68 69 6e  65 20 63 6f 64 65 22 20  | "machine code" |
00001760  2d 0a 41 52 4d 20 73 75  62 72 6f 75 74 69 6e 65  |-.ARM subroutine|
00001770  73 2e 20 49 66 20 79 6f  75 20 77 61 6e 74 20 74  |s. If you want t|
00001780  6f 20 61 74 74 61 63 68  20 61 20 68 61 6e 64 6c  |o attach a handl|
00001790  65 72 20 74 6f 20 6d 65  6e 75 20 69 74 65 6d 20  |er to menu item |
000017a0  79 6f 75 20 6d 75 73 74  0a 70 61 73 73 20 74 68  |you must.pass th|
000017b0  65 20 70 6f 69 6e 74 65  72 20 74 6f 20 74 68 65  |e pointer to the|
000017c0  20 6e 61 6d 65 20 6f 66  20 42 41 53 49 43 20 66  | name of BASIC f|
000017d0  75 6e 63 74 69 6f 6e 20  6f 72 20 72 65 73 70 65  |unction or respe|
000017e0  63 74 69 76 65 6c 79 20  74 68 65 0a 61 64 64 72  |ctively the.addr|
000017f0  65 73 73 20 6f 66 20 74  68 65 20 41 52 4d 20 73  |ess of the ARM s|
00001800  75 62 72 6f 75 74 69 6e  65 20 74 6f 20 4d 65 6e  |ubroutine to Men|
00001810  75 55 74 69 6c 5f 41 64  64 2e 0a 0a 41 66 74 65  |uUtil_Add...Afte|
00001820  72 20 75 73 65 72 20 73  65 6c 65 63 74 69 6f 6e  |r user selection|
00001830  20 74 68 65 20 63 6f 72  72 65 73 70 6f 6e 64 69  | the correspondi|
00001840  6e 67 20 69 74 65 6d 20  68 61 6e 64 6c 65 72 20  |ng item handler |
00001850  77 69 6c 6c 20 62 65 20  66 6f 75 6e 64 20 62 79  |will be found by|
00001860  0a 22 4d 65 6e 75 55 74  69 6c 5f 44 65 63 6f 64  |."MenuUtil_Decod|
00001870  65 22 2e 20 54 6f 20 69  6e 76 6f 6b 65 20 74 68  |e". To invoke th|
00001880  65 20 68 61 6e 64 6c 65  72 20 79 6f 75 20 68 61  |e handler you ha|
00001890  76 65 20 74 6f 20 63 61  6c 6c 20 65 69 74 68 65  |ve to call eithe|
000018a0  72 20 74 68 65 0a 42 41  53 49 43 20 66 75 6e 63  |r the.BASIC func|
000018b0  74 69 6f 6e 20 6f 72 20  74 68 65 20 41 52 4d 20  |tion or the ARM |
000018c0  73 75 62 72 6f 75 74 69  6e 65 20 64 65 70 65 6e  |subroutine depen|
000018d0  64 69 6e 67 20 6f 6e 20  69 6e 69 74 69 61 6c 69  |ding on initiali|
000018e0  73 61 74 69 6f 6e 20 74  79 70 65 2e 4f 74 68 65  |sation type.Othe|
000018f0  72 20 46 65 61 74 75 72  65 73 0a 4d 61 6e 79 20  |r Features.Many |
00001900  61 70 70 6c 69 63 61 74  69 6f 6e 73 20 75 73 65  |applications use|
00001910  20 73 74 61 6e 64 61 72  64 20 6d 65 6e 75 20 61  | standard menu a|
00001920  6c 6c 6f 77 69 6e 67 20  75 73 65 72 20 74 6f 20  |llowing user to |
00001930  73 65 6c 65 63 74 20 61  20 63 6f 6c 6f 75 72 0a  |select a colour.|
00001940  66 72 6f 6d 20 73 74 61  6e 64 61 72 64 20 64 65  |from standard de|
00001950  73 6b 74 6f 70 20 63 6f  6c 6f 75 72 73 2e 20 4d  |sktop colours. M|
00001960  65 6e 75 55 74 69 6c 73  20 70 72 6f 76 69 64 65  |enuUtils provide|
00001970  73 20 61 20 73 70 65 63  69 61 6c 20 53 57 49 0a  |s a special SWI.|
00001980  22 3c 4d 65 6e 75 55 74  69 6c 5f 43 6f 6c 6f 75  |"<MenuUtil_Colou|
00001990  72 4d 65 6e 75 3e 22 20  77 68 69 63 68 20 63 72  |rMenu>" which cr|
000019a0  65 61 74 65 73 20 73 75  63 68 20 63 6f 6c 6f 75  |eates such colou|
000019b0  72 20 73 65 74 74 69 6e  67 20 6d 65 6e 75 2e 41  |r setting menu.A|
000019c0  70 70 6c 69 63 61 74 69  6f 6e 20 4e 6f 74 65 73  |pplication Notes|
000019d0  0a 54 68 69 73 20 65 78  61 6d 70 6c 65 20 69 6c  |.This example il|
000019e0  6c 75 73 74 72 61 74 65  73 20 74 68 65 20 75 73  |lustrates the us|
000019f0  65 20 6f 66 20 6d 65 6e  75 20 69 74 65 6d 20 68  |e of menu item h|
00001a00  61 6e 64 6c 65 72 73 20  69 6e 20 70 72 6f 67 72  |andlers in progr|
00001a10  61 6d 73 20 69 6e 0a 42  42 43 20 42 41 53 49 43  |ams in.BBC BASIC|
00001a20  2e 20 4c 65 74 73 20 63  6f 6e 73 69 64 65 72 20  |. Lets consider |
00001a30  73 69 6d 70 6c 65 20 6d  65 6e 75 20 63 6f 6e 73  |simple menu cons|
00001a40  69 73 74 69 6e 67 20 6f  66 20 73 69 6e 67 6c 65  |isting of single|
00001a50  20 69 74 65 6d 2e 0a 0a  20 20 20 20 20 20 20 20  | item...        |
00001a60  20 20 20 20 2b 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |    +-----------|
00001a70  2d 2d 2d 2d 2d 2b 0a 20  20 20 20 20 20 20 20 20  |-----+.         |
00001a80  20 20 20 7c 20 20 20 20  20 20 20 20 20 20 20 20  |   |            |
00001a90  20 20 20 20 7c 0a 20 20  20 20 20 20 20 20 20 20  |    |.          |
00001aa0  20 20 7c 20 20 53 69 6d  70 6c 65 20 6d 65 6e 75  |  |  Simple menu|
00001ab0  20 20 20 7c 0a 20 20 20  20 20 20 20 20 20 20 20  |   |.           |
00001ac0  20 7c 20 20 20 20 20 20  20 20 20 20 20 20 20 20  | |              |
00001ad0  20 20 7c 0a 20 20 20 20  20 20 20 20 20 20 20 20  |  |.            |
00001ae0  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |+---------------|
00001af0  2d 2b 0a 20 20 20 20 20  20 20 20 20 20 20 20 7c  |-+.            ||
00001b00  20 20 49 74 65 6d 23 31  20 20 20 20 20 20 20 20  |  Item#1        |
00001b10  7c 20 20 0a 20 20 20 20  20 20 20 20 20 20 20 20  ||  .            |
00001b20  2b 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |+---------------|
00001b30  2d 2b 0a 0a 54 6f 20 63  72 65 61 74 65 20 74 68  |-+..To create th|
00001b40  69 73 20 6d 65 6e 75 20  77 65 20 6d 75 73 74 20  |is menu we must |
00001b50  63 61 6c 6c 20 22 3c 4d  65 6e 75 55 74 69 6c 5f  |call "<MenuUtil_|
00001b60  4e 65 77 3e 22 20 61 6e  64 20 74 6f 20 61 64 64  |New>" and to add|
00001b70  20 61 6e 20 69 74 65 6d  20 2d 0a 22 3c 4d 65 6e  | an item -."<Men|
00001b80  75 55 74 69 6c 5f 41 64  64 3e 22 2e 0a 0a 20 53  |uUtil_Add>"... S|
00001b90  59 53 20 22 4d 65 6e 75  55 74 69 6c 5f 4e 65 77  |YS "MenuUtil_New|
00001ba0  22 2c 2c 22 53 69 6d 70  6c 65 20 6d 65 6e 75 22  |",,"Simple menu"|
00001bb0  0a 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |. SYS "MenuUtil_|
00001bc0  41 64 64 22 2c 2c 22 49  74 65 6d 23 31 22 2c 22  |Add",,"Item#1","|
00001bd0  66 75 6e 63 31 22 0a 0a  2d 20 68 65 72 65 20 22  |func1"..- here "|
00001be0  53 69 6d 70 6c 65 20 6d  65 6e 75 22 20 69 73 20  |Simple menu" is |
00001bf0  6d 65 6e 75 20 74 69 74  6c 65 2c 20 22 49 74 65  |menu title, "Ite|
00001c00  6d 23 31 22 20 2d 20 69  74 65 6d 20 74 65 78 74  |m#1" - item text|
00001c10  20 61 6e 64 20 22 66 75  6e 63 31 22 20 2d 0a 6e  | and "func1" -.n|
00001c20  61 6d 65 20 6f 66 20 74  68 65 20 69 74 65 6d 20  |ame of the item |
00001c30  68 61 6e 64 6c 65 72 2e  20 54 68 65 20 6e 61 6d  |handler. The nam|
00001c40  65 20 6f 66 20 74 68 65  20 68 61 6e 64 6c 65 72  |e of the handler|
00001c50  20 69 73 20 22 66 75 6e  63 31 22 20 73 6f 20 77  | is "func1" so w|
00001c60  65 0a 6d 75 73 74 20 68  61 76 65 20 61 20 66 75  |e.must have a fu|
00001c70  6e 63 74 69 6f 6e 20 77  69 74 68 20 74 68 65 20  |nction with the |
00001c80  6e 61 6d 65 20 22 46 4e  66 75 6e 63 31 22 2e 0a  |name "FNfunc1"..|
00001c90  0a 20 44 45 46 20 46 4e  66 75 6e 63 31 0a 20 2e  |. DEF FNfunc1. .|
00001ca0  2e 2e 0a 20 3d 54 52 55  45 0a 0a 54 68 65 6e 20  |... =TRUE..Then |
00001cb0  77 65 20 6f 72 67 61 6e  69 7a 65 20 74 68 65 20  |we organize the |
00001cc0  6d 61 69 6e 20 57 69 6d  70 5f 50 6f 6c 6c 20 6c  |main Wimp_Poll l|
00001cd0  6f 6f 70 20 69 6e 20 74  68 65 20 66 6f 6c 6c 6f  |oop in the follo|
00001ce0  77 69 6e 67 20 77 61 79  2e 0a 0a 20 44 49 4d 20  |wing way... DIM |
00001cf0  71 25 20 26 31 30 30 0a  20 52 45 50 45 41 54 20  |q% &100. REPEAT |
00001d00  53 59 53 20 22 57 69 6d  70 5f 50 6f 6c 6c 22 2c  |SYS "Wimp_Poll",|
00001d10  2c 71 25 20 54 4f 20 72  65 61 73 6f 6e 25 0a 20  |,q% TO reason%. |
00001d20  20 20 43 41 53 45 20 72  65 61 73 6f 6e 25 20 4f  |  CASE reason% O|
00001d30  46 0a 20 20 20 20 20 2e  2e 2e 20 20 20 20 20 20  |F.     ...      |
00001d40  20 20 20 0a 20 20 20 20  20 52 45 4d 20 4d 6f 75  |   .     REM Mou|
00001d50  73 65 20 63 6c 69 63 6b  0a 20 20 20 20 20 57 48  |se click.     WH|
00001d60  45 4e 20 36 0a 20 20 20  20 20 20 20 20 20 20 20  |EN 6.           |
00001d70  20 49 46 20 71 25 21 38  3d 32 20 54 48 45 4e 20  | IF q%!8=2 THEN |
00001d80  53 59 53 20 22 3c 4d 65  6e 75 55 74 69 6c 5f 53  |SYS "<MenuUtil_S|
00001d90  68 6f 77 3e 22 2c 2c 71  25 0a 20 0a 20 20 20 20  |how>",,q%. .    |
00001da0  20 52 45 4d 20 4d 65 6e  75 20 73 65 6c 65 63 74  | REM Menu select|
00001db0  69 6f 6e 20 20 0a 20 20  20 20 20 57 48 45 4e 20  |ion  .     WHEN |
00001dc0  39 0a 20 20 20 20 20 20  20 20 20 20 20 20 53 59  |9.            SY|
00001dd0  53 20 22 3c 4d 65 6e 75  55 74 69 6c 5f 44 65 63  |S "<MenuUtil_Dec|
00001de0  6f 64 65 3e 22 2c 2c 71  25 20 54 4f 20 68 61 6e  |ode>",,q% TO han|
00001df0  64 6c 65 72 25 0a 20 20  20 20 20 20 20 20 20 20  |dler%.          |
00001e00  20 20 49 46 20 68 61 6e  64 6c 65 72 25 20 54 48  |  IF handler% TH|
00001e10  45 4e 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |EN.             |
00001e20  20 68 61 6e 64 6c 65 72  24 3d 22 46 4e 22 2b 24  | handler$="FN"+$|
00001e30  68 61 6e 64 6c 65 72 25  20 20 20 0a 20 20 20 20  |handler%   .    |
00001e40  20 20 20 20 20 20 20 20  20 20 49 46 20 45 56 41  |          IF EVA|
00001e50  4c 20 68 61 6e 64 6c 65  72 24 0a 20 20 20 20 20  |L handler$.     |
00001e60  20 20 20 20 20 20 20 45  4e 44 49 46 0a 20 20 20  |       ENDIF.   |
00001e70  20 20 2e 2e 2e 0a 20 20  20 45 4e 44 43 41 53 45  |  ....   ENDCASE|
00001e80  0a 20 55 4e 54 49 4c 20  46 41 4c 53 45 0a 20 20  |. UNTIL FALSE.  |
00001e90  20 20 0a 49 66 20 74 68  65 20 75 73 65 72 20 63  |  .If the user c|
00001ea0  6c 69 63 6b 73 20 77 69  74 68 20 4d 65 6e 75 20  |licks with Menu |
00001eb0  62 75 74 74 6f 6e 20 77  65 20 77 69 6c 6c 20 63  |button we will c|
00001ec0  61 6c 6c 20 22 3c 4d 65  6e 75 55 74 69 6c 5f 53  |all "<MenuUtil_S|
00001ed0  68 6f 77 3e 22 20 74 6f  0a 64 69 73 70 6c 61 79  |how>" to.display|
00001ee0  20 6d 65 6e 75 20 6f 6e  20 73 63 72 65 65 6e 2e  | menu on screen.|
00001ef0  20 49 66 20 75 73 65 72  20 73 65 6c 65 63 74 73  | If user selects|
00001f00  20 73 6f 6d 65 74 68 69  6e 67 20 66 72 6f 6d 20  | something from |
00001f10  6f 75 72 20 6d 65 6e 75  20 77 65 0a 77 69 6c 6c  |our menu we.will|
00001f20  20 63 61 6c 6c 20 22 3c  4d 65 6e 75 55 74 69 6c  | call "<MenuUtil|
00001f30  5f 44 65 63 6f 64 65 3e  22 20 74 6f 20 66 69 6e  |_Decode>" to fin|
00001f40  64 20 6f 75 74 20 63 6f  72 72 65 73 70 6f 6e 64  |d out correspond|
00001f50  69 6e 67 20 69 74 65 6d  20 68 61 6e 64 6c 65 72  |ing item handler|
00001f60  2e 0a 56 61 72 69 61 62  6c 65 20 68 61 6e 64 6c  |..Variable handl|
00001f70  65 72 25 20 77 69 6c 6c  20 63 6f 6e 74 61 69 6e  |er% will contain|
00001f80  20 70 6f 69 6e 74 65 72  20 74 6f 20 74 68 65 20  | pointer to the |
00001f90  68 61 6e 64 6c 65 72 20  6e 61 6d 65 2e 20 49 6e  |handler name. In|
00001fa0  20 6f 75 72 0a 65 78 61  6d 70 6c 65 20 69 66 20  | our.example if |
00001fb0  75 73 65 72 20 77 69 6c  6c 20 73 65 6c 65 63 74  |user will select|
00001fc0  20 69 74 65 6d 20 22 49  74 65 6d 23 31 22 20 76  | item "Item#1" v|
00001fd0  61 72 69 61 62 6c 65 20  68 61 6e 64 6c 65 72 25  |ariable handler%|
00001fe0  20 77 69 6c 6c 20 70 6f  69 6e 74 0a 74 6f 20 73  | will point.to s|
00001ff0  74 72 69 6e 67 20 22 66  75 6e 63 31 22 2e 20 54  |tring "func1". T|
00002000  68 65 20 66 75 6c 6c 20  6e 61 6d 65 20 6f 66 20  |he full name of |
00002010  74 68 65 20 68 61 6e 64  6c 65 72 20 77 69 6c 6c  |the handler will|
00002020  20 62 65 0a 22 46 4e 22  2b 24 68 61 6e 64 6c 65  | be."FN"+$handle|
00002030  72 25 2e 20 41 6e 64 20  45 56 41 4c 20 73 74 61  |r%. And EVAL sta|
00002040  74 65 6d 65 6e 74 20 69  73 20 75 73 65 64 20 74  |tement is used t|
00002050  6f 20 63 61 6c 6c 20 69  74 2e 4e 6f 74 65 73 20  |o call it.Notes |
00002060  46 72 6f 6d 20 54 68 65  20 41 75 74 68 6f 72 0a  |From The Author.|
00002070  4d 65 6e 75 55 74 69 6c  73 20 69 73 20 66 72 65  |MenuUtils is fre|
00002080  65 77 61 72 65 20 73 6f  66 74 77 61 72 65 2e 20  |eware software. |
00002090  45 76 65 72 79 62 6f 64  79 20 69 73 20 66 72 65  |Everybody is fre|
000020a0  65 20 74 6f 20 75 73 65  20 4d 65 6e 75 55 74 69  |e to use MenuUti|
000020b0  6c 73 0a 6d 6f 64 75 6c  65 2c 20 65 76 65 6e 20  |ls.module, even |
000020c0  69 6e 20 63 6f 6d 6d 65  72 63 69 61 6c 20 63 6f  |in commercial co|
000020d0  64 65 2e 20 49 6e 20 63  61 73 65 20 6f 66 20 63  |de. In case of c|
000020e0  6f 6d 6d 65 72 63 69 61  6c 20 75 73 65 20 49 20  |ommercial use I |
000020f0  77 6f 75 6c 64 0a 6c 69  6b 65 20 74 6f 20 6b 6e  |would.like to kn|
00002100  6f 77 20 74 68 69 73 20  69 6e 20 61 64 76 61 6e  |ow this in advan|
00002110  63 65 20 28 49 20 63 6f  75 6c 64 20 74 68 61 6e  |ce (I could than|
00002120  20 70 72 6f 76 69 64 65  20 79 6f 75 20 77 69 74  | provide you wit|
00002130  68 20 74 68 65 20 6c 61  74 65 73 74 0a 72 65 6c  |h the latest.rel|
00002140  65 61 73 65 29 2e 20 59  6f 75 20 63 61 6e 20 61  |ease). You can a|
00002150  6c 77 61 79 73 20 63 6f  6e 74 61 63 74 20 6d 65  |lways contact me|
00002160  20 69 66 20 79 6f 75 20  66 6f 75 6e 64 20 73 6f  | if you found so|
00002170  6d 65 20 62 75 67 2c 20  6f 72 20 77 68 65 6e 0a  |me bug, or when.|
00002180  68 61 76 69 6e 67 20 6f  74 68 65 72 20 73 75 67  |having other sug|
00002190  67 65 73 74 69 6f 6e 73  2e 0a 0a 20 20 20 20 20  |gestions...     |
000021a0  20 20 20 20 54 6f 20 63  6f 6e 74 61 63 74 20 74  |    To contact t|
000021b0  68 65 20 61 75 74 68 6f  72 20 6f 66 20 4d 65 6e  |he author of Men|
000021c0  75 55 74 69 6c 73 2c 20  70 6c 65 61 73 65 20 77  |uUtils, please w|
000021d0  72 69 74 65 20 74 6f 3a  0a 20 20 20 20 20 20 20  |rite to:.       |
000021e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000021f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 0a  |               .|
00002200  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002220  20 20 20 20 20 20 20 20  52 55 53 53 49 41 0a 20  |        RUSSIA. |
00002230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002250  20 20 20 20 20 20 20 31  31 35 35 34 31 0a 20 20  |       115541.  |
00002260  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00002280  20 20 20 20 20 20 4d 6f  73 63 6f 77 0a 20 20 20  |      Moscow.   |
00002290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000022b0  20 20 20 20 20 4b 61 76  6b 61 7a 73 6b 79 20 62  |     Kavkazsky b|
000022c0  6f 75 6c 65 76 61 72 64  2c 20 32 39 0a 20 20 20  |oulevard, 29.   |
000022d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000022f0  20 20 20 20 20 42 6c 64  2e 20 31 2c 20 46 6c 61  |     Bld. 1, Fla|
00002300  74 20 31 30 37 0a 20 20  20 20 20 20 20 20 20 20  |t 107.          |
00002310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002320  20 20 20 20 20 20 20 20  20 20 20 20 20 20 41 6c  |              Al|
00002330  65 78 20 50 65 74 72 6f  76 20 20 20 20 0a 0a 20  |ex Petrov    .. |
00002340  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002350  20 20 20 20 20 20 20 20  45 2d 6d 61 69 6c 3a 20  |        E-mail: |
00002360  41 50 65 74 72 6f 76 40  6d 69 73 69 73 2e 6d 73  |APetrov@misis.ms|
00002370  6b 2e 73 75 20 20 20 20  20 20 0a 20 20 20 20 20  |k.su      .     |
00002380  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002390  20 20 20 20 20 20 20 20  20 20 20 20 41 50 65 74  |            APet|
000023a0  72 6f 76 40 61 72 6d 2e  6d 73 6b 2e 73 75 0a 20  |rov@arm.msk.su. |
000023b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000023d0  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
000023e0  20 20 20 20 20 20 20 20  20 20 46 49 44 4f 20 3a  |          FIDO :|
000023f0  20 20 32 3a 35 30 32 30  2f 31 30 34 2e 31 33 0a  |  2:5020/104.13.|
00002400  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00002410  20 20 20 20 20 20 20 20  20 20 20 70 68 6f 6e 65  |           phone|
00002420  3a 20 2b 37 20 30 39 35  20 33 32 32 20 32 30 39  |: +7 095 322 209|
00002430  38 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |8.              |
00002440  20 20 20 20 20 20 20 20  20 20 20 20 66 61 78 20  |            fax |
00002450  20 3a 20 2b 37 20 30 39  35 20 32 33 36 20 38 33  | : +7 095 236 83|
00002460  35 30 4d 65 6e 75 55 74  69 6c 73 20 6d 6f 64 75  |50MenuUtils modu|
00002470  6c 65 20 76 2e 30 2e 31  30 0a 41 6c 6c 20 53 57  |le v.0.10.All SW|
00002480  49 73 20 61 72 65 20 70  72 65 66 69 78 65 64 20  |Is are prefixed |
00002490  77 69 74 68 20 27 4d 65  6e 75 55 74 69 6c 5f 27  |with 'MenuUtil_'|
000024a0  2e 0a 43 6c 69 63 6b 20  3c 68 65 72 65 3d 3e 44  |..Click <here=>D|
000024b0  6f 63 73 3e 20 66 6f 72  20 66 75 72 74 68 65 72  |ocs> for further|
000024c0  20 64 6f 63 75 6d 65 6e  74 61 74 69 6f 6e 0a 61  | documentation.a|
000024d0  6e 64 20 70 72 6f 67 72  61 6d 6d 69 6e 67 20 65  |nd programming e|
000024e0  78 61 6d 70 6c 65 73 2e  0a 0a 23 54 61 62 6c 65  |xamples...#Table|
000024f0  20 36 20 31 34 0a 3c 49  6e 69 74 69 61 6c 69 73  | 6 14.<Initialis|
00002500  65 20 3d 3e 4d 65 6e 75  55 74 69 6c 5f 49 6e 69  |e =>MenuUtil_Ini|
00002510  74 69 61 6c 69 73 65 3e  20 20 20 20 0a 3c 4e 65  |tialise>    .<Ne|
00002520  77 20 20 20 20 20 20 20  20 3d 3e 4d 65 6e 75 55  |w        =>MenuU|
00002530  74 69 6c 5f 4e 65 77 3e  20 20 20 20 20 20 20 20  |til_New>        |
00002540  20 20 20 0a 3c 41 64 64  20 20 20 20 20 20 20 20  |   .<Add        |
00002550  3d 3e 4d 65 6e 75 55 74  69 6c 5f 41 64 64 3e 20  |=>MenuUtil_Add> |
00002560  20 20 20 20 20 20 20 20  20 20 0a 3c 44 65 6c 65  |          .<Dele|
00002570  74 65 20 20 20 20 20 3d  3e 4d 65 6e 75 55 74 69  |te     =>MenuUti|
00002580  6c 5f 44 65 6c 65 74 65  3e 20 20 0a 3c 44 65 63  |l_Delete>  .<Dec|
00002590  6f 64 65 20 20 20 20 20  3d 3e 4d 65 6e 75 55 74  |ode     =>MenuUt|
000025a0  69 6c 5f 44 65 63 6f 64  65 3e 0a 3c 53 68 6f 77  |il_Decode>.<Show|
000025b0  20 20 20 20 20 20 20 3d  3e 4d 65 6e 75 55 74 69  |       =>MenuUti|
000025c0  6c 5f 53 68 6f 77 3e 0a  3c 53 68 6f 77 53 75 62  |l_Show>.<ShowSub|
000025d0  4d 65 6e 75 3d 3e 4d 65  6e 75 55 74 69 6c 5f 53  |Menu=>MenuUtil_S|
000025e0  68 6f 77 53 75 62 4d 65  6e 75 3e 0a 3c 49 6e 66  |howSubMenu>.<Inf|
000025f0  6f 20 20 20 20 20 20 20  3d 3e 4d 65 6e 75 55 74  |o       =>MenuUt|
00002600  69 6c 5f 49 6e 66 6f 3e  0a 3c 54 65 78 74 20 20  |il_Info>.<Text  |
00002610  20 20 20 20 20 3d 3e 4d  65 6e 75 55 74 69 6c 5f  |     =>MenuUtil_|
00002620  54 65 78 74 3e 0a 3c 54  69 63 6b 20 20 20 20 20  |Text>.<Tick     |
00002630  20 20 3d 3e 4d 65 6e 75  55 74 69 6c 5f 54 69 63  |  =>MenuUtil_Tic|
00002640  6b 3e 0a 3c 44 6f 74 73  20 20 20 20 20 20 20 3d  |k>.<Dots       =|
00002650  3e 4d 65 6e 75 55 74 69  6c 5f 44 6f 74 73 3e 0a  |>MenuUtil_Dots>.|
00002660  3c 46 61 64 65 20 20 20  20 20 20 20 3d 3e 4d 65  |<Fade       =>Me|
00002670  6e 75 55 74 69 6c 5f 46  61 64 65 3e 0a 3c 57 61  |nuUtil_Fade>.<Wa|
00002680  72 6e 69 6e 67 20 20 20  20 3d 3e 4d 65 6e 75 55  |rning    =>MenuU|
00002690  74 69 6c 5f 57 61 72 6e  69 6e 67 3e 0a 3c 57 72  |til_Warning>.<Wr|
000026a0  69 74 61 62 6c 65 20 20  20 3d 3e 4d 65 6e 75 55  |itable   =>MenuU|
000026b0  74 69 6c 5f 57 72 69 74  61 62 6c 65 3e 0a 3c 53  |til_Writable>.<S|
000026c0  75 62 4d 65 6e 75 20 20  20 20 3d 3e 4d 65 6e 75  |ubMenu    =>Menu|
000026d0  55 74 69 6c 5f 53 75 62  4d 65 6e 75 3e 0a 3c 43  |Util_SubMenu>.<C|
000026e0  6f 6c 6f 75 72 4d 65 6e  75 20 3d 3e 4d 65 6e 75  |olourMenu =>Menu|
000026f0  55 74 69 6c 5f 43 6f 6c  6f 75 72 4d 65 6e 75 3e  |Util_ColourMenu>|
00002700  0a 3c 43 6f 6c 6f 75 72  73 20 20 20 20 3d 3e 4d  |.<Colours    =>M|
00002710  65 6e 75 55 74 69 6c 5f  43 6f 6c 6f 75 72 73 3e  |enuUtil_Colours>|
00002720  0a 3c 54 69 63 6b 4f 6e  6c 79 20 20 20 3d 3e 4d  |.<TickOnly   =>M|
00002730  65 6e 75 55 74 69 6c 5f  54 69 63 6b 4f 6e 6c 79  |enuUtil_TickOnly|
00002740  3e 0a 23 45 6e 64 54 61  62 6c 65 4d 65 6e 75 55  |>.#EndTableMenuU|
00002750  74 69 6c 73 20 6d 6f 64  75 6c 65 20 76 2e 30 2e  |tils module v.0.|
00002760  31 30 0a 3c 49 6e 74 72  6f 64 75 63 74 69 6f 6e  |10.<Introduction|
00002770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002780  20 20 20 3d 3e 49 6e 74  72 6f 3e 0a 3c 57 68 61  |   =>Intro>.<Wha|
00002790  74 20 64 6f 65 73 20 4d  65 6e 75 55 74 69 6c 73  |t does MenuUtils|
000027a0  20 64 6f 20 3f 20 20 20  20 20 20 20 3d 3e 57 68  | do ?       =>Wh|
000027b0  61 74 44 6f 3e 0a 3c 54  65 63 68 6e 69 63 61 6c  |atDo>.<Technical|
000027c0  20 64 65 74 61 69 6c 73  20 20 20 20 20 20 20 20  | details        |
000027d0  20 20 20 20 20 20 3d 3e  54 65 63 68 44 65 74 3e  |      =>TechDet>|
000027e0  0a 3c 4d 65 6e 75 20 68  61 6e 64 6c 65 73 20 20  |.<Menu handles  |
000027f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002800  20 3d 3e 4d 48 61 6e 64  6c 65 73 3e 0a 3c 4d 65  | =>MHandles>.<Me|
00002810  6e 75 20 63 72 65 61 74  69 6f 6e 20 20 20 20 20  |nu creation     |
00002820  20 20 20 20 20 20 20 20  20 20 20 20 20 3d 3e 4d  |             =>M|
00002830  43 72 65 61 74 69 6f 6e  3e 0a 3c 4d 65 6e 75 20  |Creation>.<Menu |
00002840  6d 6f 64 69 66 69 63 61  74 69 6f 6e 20 20 20 20  |modification    |
00002850  20 20 20 20 20 20 20 20  20 20 3d 3e 4d 4d 6f 64  |          =>MMod|
00002860  69 66 69 63 61 74 69 6f  6e 3e 0a 3c 44 69 73 70  |ification>.<Disp|
00002870  6c 61 79 69 6e 67 20 6d  65 6e 75 20 6f 6e 20 73  |laying menu on s|
00002880  63 72 65 65 6e 20 20 20  20 20 20 3d 3e 44 69 73  |creen      =>Dis|
00002890  70 6c 61 79 69 6e 67 3e  0a 3c 49 74 65 6d 20 68  |playing>.<Item h|
000028a0  61 6e 64 6c 65 72 73 20  61 6e 64 20 6d 65 6e 75  |andlers and menu|
000028b0  20 64 65 63 6f 64 69 6e  67 3d 3e 48 61 6e 64 6c  | decoding=>Handl|
000028c0  65 72 73 3e 0a 3c 4f 74  68 65 72 20 66 65 61 74  |ers>.<Other feat|
000028d0  75 72 65 73 20 20 20 20  20 20 20 20 20 20 20 20  |ures            |
000028e0  20 20 20 20 20 3d 3e 46  65 61 74 75 72 65 73 3e  |     =>Features>|
000028f0  0a 3c 41 70 70 6c 69 63  61 74 69 6f 6e 20 6e 6f  |.<Application no|
00002900  74 65 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |tes             |
00002910  20 3d 3e 41 70 70 4e 6f  74 65 73 3e 0a 3c 4e 6f  | =>AppNotes>.<No|
00002920  74 65 73 20 66 72 6f 6d  20 74 68 65 20 61 75 74  |tes from the aut|
00002930  68 6f 72 20 20 20 20 20  20 20 20 20 20 3d 3e 41  |hor          =>A|
00002940  75 74 68 6f 72 3e 4d 65  6e 75 55 74 69 6c 5f 49  |uthor>MenuUtil_I|
00002950  6e 69 74 69 61 6c 69 73  65 20 28 53 57 49 20 26  |nitialise (SWI &|
00002960  34 35 42 43 30 29 0a 54  6f 20 72 65 67 69 73 74  |45BC0).To regist|
00002970  65 72 20 74 68 65 20 74  61 73 6b 20 61 73 20 4d  |er the task as M|
00002980  65 6e 75 55 74 69 6c 73  20 63 6c 69 65 6e 74 0a  |enuUtils client.|
00002990  0a 45 6e 74 72 79 3a 0a  20 20 20 20 52 30 20 6c  |.Entry:.    R0 l|
000029a0  61 73 74 20 4d 65 6e 75  55 74 69 6c 73 20 76 65  |ast MenuUtils ve|
000029b0  72 73 69 6f 6e 20 6e 75  6d 62 65 72 20 6b 6e 6f  |rsion number kno|
000029c0  77 6e 20 74 6f 20 74 61  73 6b 20 2a 20 31 30 30  |wn to task * 100|
000029d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000029e0  0a 20 20 20 20 52 31 20  69 6e 69 74 69 61 6c 69  |.    R1 initiali|
000029f0  73 61 74 69 6f 6e 20 74  79 70 65 20 28 73 65 65  |sation type (see|
00002a00  20 6c 61 74 65 72 29 0a  20 20 20 20 20 20 20 62  | later).       b|
00002a10  69 74 20 30 0a 20 20 20  20 20 20 20 20 20 20 20  |it 0.           |
00002a20  30 20 2d 20 22 42 41 53  49 43 22 0a 20 20 20 20  |0 - "BASIC".    |
00002a30  20 20 20 20 20 20 20 31  20 2d 20 22 6d 61 63 68  |       1 - "mach|
00002a40  69 6e 65 20 63 6f 64 65  22 20 28 6e 6f 74 20 73  |ine code" (not s|
00002a50  75 70 70 6f 72 74 65 64  20 62 79 20 63 75 72 72  |upported by curr|
00002a60  65 6e 74 20 76 65 72 73  69 6f 6e 29 0a 45 78 69  |ent version).Exi|
00002a70  74 3a 0a 20 20 20 20 52  30 20 76 65 72 73 69 6f  |t:.    R0 versio|
00002a80  6e 20 6e 75 6d 62 65 72  20 2a 20 31 30 30 0a 20  |n number * 100. |
00002a90  20 20 20 52 31 2c 52 32  20 70 72 65 73 65 72 76  |   R1,R2 preserv|
00002aa0  65 64 20 20 20 20 20 0a  0a 4d 65 6e 75 55 74 69  |ed     ..MenuUti|
00002ab0  6c 5f 49 6e 69 74 69 61  6c 69 73 65 20 73 68 6f  |l_Initialise sho|
00002ac0  75 6c 64 20 6f 6e 6c 79  20 62 65 20 63 61 6c 6c  |uld only be call|
00002ad0  65 64 20 6f 6e 63 65 20  77 68 65 6e 20 74 68 65  |ed once when the|
00002ae0  20 74 61 73 6b 20 73 74  61 72 74 73 20 75 70 2e  | task starts up.|
00002af0  20 49 74 0a 6d 75 73 74  20 62 65 20 63 61 6c 6c  | It.must be call|
00002b00  65 64 20 61 66 74 65 72  20 57 69 6d 70 5f 49 6e  |ed after Wimp_In|
00002b10  69 74 69 61 6c 69 73 65  20 68 61 73 20 62 65 65  |itialise has bee|
00002b20  6e 20 63 61 6c 6c 65 64  20 61 6e 64 20 62 65 66  |n called and bef|
00002b30  6f 72 65 20 61 6e 79 0a  6f 74 68 65 72 20 63 61  |ore any.other ca|
00002b40  6c 6c 20 74 6f 20 74 68  65 20 4d 65 6e 75 55 74  |ll to the MenuUt|
00002b50  69 6c 73 20 6d 6f 64 75  6c 65 20 69 73 20 6d 61  |ils module is ma|
00002b60  64 65 2e 0a 0a 4d 65 6e  75 55 74 69 6c 73 20 70  |de...MenuUtils p|
00002b70  65 72 66 6f 72 6d 73 20  61 6c 6c 20 74 68 65 20  |erforms all the |
00002b80  63 6c 6f 73 65 64 6f 77  6e 20 77 6f 72 6b 20 61  |closedown work a|
00002b90  75 74 6f 6d 61 74 69 63  61 6c 6c 79 20 77 68 65  |utomatically whe|
00002ba0  6e 20 74 68 65 0a 74 61  73 6b 20 66 69 6e 69 73  |n the.task finis|
00002bb0  68 65 73 20 73 6f 20 6e  6f 20 73 70 65 63 69 61  |hes so no specia|
00002bc0  6c 20 4d 65 6e 75 55 74  69 6c 5f 43 6c 6f 73 65  |l MenuUtil_Close|
00002bd0  44 6f 77 6e 20 53 57 49  20 69 73 20 70 72 6f 76  |Down SWI is prov|
00002be0  69 64 65 64 2e 0a 0a 3c  45 78 61 6d 70 6c 65 20  |ided...<Example |
00002bf0  63 6f 64 65 2e 2e 2e 3d  3e 45 78 5f 49 6e 69 74  |code...=>Ex_Init|
00002c00  69 61 6c 69 73 65 3e 4d  65 6e 75 55 74 69 6c 5f  |ialise>MenuUtil_|
00002c10  4e 65 77 20 28 53 57 49  20 26 34 35 42 43 31 29  |New (SWI &45BC1)|
00002c20  0a 43 72 65 61 74 65 73  20 6e 65 77 20 65 6d 70  |.Creates new emp|
00002c30  74 79 20 6d 65 6e 75 2e  0a 0a 45 6e 74 72 79 3a  |ty menu...Entry:|
00002c40  0a 20 20 20 20 52 31 20  70 6f 69 6e 74 65 72 20  |.    R1 pointer |
00002c50  74 6f 20 6d 65 6e 75 20  74 69 74 6c 65 20 73 74  |to menu title st|
00002c60  72 69 6e 67 0a 20 20 20  20 52 32 20 61 70 70 72  |ring.    R2 appr|
00002c70  6f 78 69 6d 61 74 65 20  6e 75 6d 62 65 72 20 6f  |oximate number o|
00002c80  66 20 69 74 65 6d 73 20  28 64 65 66 61 75 6c 74  |f items (default|
00002c90  20 35 29 0a 0a 45 78 69  74 3a 0a 20 20 20 20 52  | 5)..Exit:.    R|
00002ca0  30 20 68 61 6e 64 6c 65  20 6f 66 20 63 72 65 61  |0 handle of crea|
00002cb0  74 65 64 20 6d 65 6e 75  0a 20 20 20 20 0a 54 68  |ted menu.    .Th|
00002cc0  69 73 20 63 61 6c 6c 20  63 72 65 61 74 65 73 20  |is call creates |
00002cd0  6e 65 77 20 65 6d 70 74  79 20 6d 65 6e 75 20 77  |new empty menu w|
00002ce0  69 74 68 20 73 70 65 63  69 66 69 65 64 20 74 69  |ith specified ti|
00002cf0  74 6c 65 20 73 74 72 69  6e 67 2e 20 43 6f 6c 6f  |tle string. Colo|
00002d00  75 72 73 0a 61 6e 64 20  64 69 6d 65 6e 73 69 6f  |urs.and dimensio|
00002d10  6e 73 20 6f 66 20 74 68  65 20 6d 65 6e 75 20 61  |ns of the menu a|
00002d20  72 65 20 69 6e 20 73 74  61 6e 64 61 72 64 20 52  |re in standard R|
00002d30  49 53 43 20 4f 53 20 73  74 79 6c 65 2e 20 59 6f  |ISC OS style. Yo|
00002d40  75 20 63 61 6e 0a 73 70  65 63 69 66 79 20 6e 75  |u can.specify nu|
00002d50  6d 62 65 72 20 6f 66 20  69 74 65 6d 73 20 79 6f  |mber of items yo|
00002d60  75 20 61 72 65 20 67 6f  69 6e 67 20 74 6f 20 68  |u are going to h|
00002d70  61 76 65 20 69 6e 20 74  68 69 73 20 6d 65 6e 75  |ave in this menu|
00002d80  2e 20 54 68 69 73 20 69  73 0a 6f 70 74 69 6f 6e  |. This is.option|
00002d90  61 6c 20 62 75 74 20 69  74 20 63 61 6e 20 73 70  |al but it can sp|
00002da0  65 65 64 20 75 70 20 74  68 65 20 70 72 6f 63 65  |eed up the proce|
00002db0  73 73 20 6f 66 20 6d 65  6e 75 20 63 72 65 61 74  |ss of menu creat|
00002dc0  69 6f 6e 2e 20 49 74 0a  6d 61 79 20 62 65 20 69  |ion. It.may be i|
00002dd0  6d 70 6f 72 74 61 6e 74  20 66 6f 72 20 62 69 67  |mportant for big|
00002de0  20 6d 65 6e 75 73 20 28  66 6f 72 20 65 78 61 6d  | menus (for exam|
00002df0  70 6c 65 20 66 6f 72 20  6f 6c 64 73 74 79 6c 65  |ple for oldstyle|
00002e00  20 66 6f 6e 74 73 20 6d  65 6e 75 29 2e 0a 0a 41  | fonts menu)...A|
00002e10  73 20 57 69 6e 64 6f 77  20 4d 61 6e 61 67 65 72  |s Window Manager|
00002e20  20 64 6f 65 73 6e 27 74  20 61 6c 6c 6f 77 20 79  | doesn't allow y|
00002e30  6f 75 20 74 6f 20 68 61  76 65 20 6d 65 6e 75 73  |ou to have menus|
00002e40  20 61 62 73 6f 6c 75 74  65 6c 79 20 77 69 74 68  | absolutely with|
00002e50  6f 75 74 0a 6d 65 6e 75  20 69 74 65 6d 73 20 73  |out.menu items s|
00002e60  6f 20 65 61 63 68 20 6e  65 77 20 6d 65 6e 75 20  |o each new menu |
00002e70  69 73 20 63 72 65 61 74  65 64 20 74 6f 67 65 74  |is created toget|
00002e80  68 65 72 20 77 69 74 68  20 6f 6e 65 20 73 70 65  |her with one spe|
00002e90  63 69 61 6c 20 69 74 65  6d 2e 0a 54 68 69 73 20  |cial item..This |
00002ea0  69 74 65 6d 20 69 73 20  63 72 65 61 74 65 64 20  |item is created |
00002eb0  77 69 74 68 20 74 68 65  20 6f 6e 6c 79 20 61 69  |with the only ai|
00002ec0  6d 20 74 6f 20 70 72 65  76 65 6e 74 20 63 72 61  |m to prevent cra|
00002ed0  73 68 65 73 20 69 6e 20  63 61 73 65 20 79 6f 75  |shes in case you|
00002ee0  0a 77 69 6c 6c 20 61 63  63 69 64 65 6e 74 69 61  |.will accidentia|
00002ef0  6c 6c 79 20 74 72 79 20  74 6f 20 6f 70 65 6e 20  |lly try to open |
00002f00  75 6e 66 69 6e 69 73 68  65 64 20 6d 65 6e 75 2e  |unfinished menu.|
00002f10  20 54 68 65 20 73 70 65  63 69 61 6c 20 69 74 65  | The special ite|
00002f20  6d 20 77 69 6c 6c 0a 62  65 20 72 65 6d 6f 76 65  |m will.be remove|
00002f30  64 20 61 75 74 6f 6d 61  74 69 63 61 6c 6c 79 20  |d automatically |
00002f40  6a 75 73 74 20 61 66 74  65 72 20 79 6f 75 20 61  |just after you a|
00002f50  64 64 20 79 6f 75 72 20  66 69 72 73 74 20 69 74  |dd your first it|
00002f60  65 6d 20 74 6f 20 74 68  69 73 0a 6d 65 6e 75 2e  |em to this.menu.|
00002f70  0a 0a 49 66 20 79 6f 75  72 20 70 72 6f 67 72 61  |..If your progra|
00002f80  6d 20 68 61 73 20 63 6f  6d 70 6c 65 78 20 6d 65  |m has complex me|
00002f90  6e 75 20 73 74 72 75 63  74 75 72 65 20 77 69 74  |nu structure wit|
00002fa0  68 20 73 75 62 6d 65 6e  75 73 20 74 68 65 6e 20  |h submenus then |
00002fb0  79 6f 75 20 63 61 6e 0a  75 73 65 20 74 68 69 73  |you can.use this|
00002fc0  20 63 61 6c 6c 20 74 6f  20 63 72 65 61 74 65 20  | call to create |
00002fd0  6e 6f 74 20 6f 6e 6c 79  20 6d 61 69 6e 20 6d 65  |not only main me|
00002fe0  6e 75 20 62 75 74 20 61  6c 73 6f 20 61 6c 6c 20  |nu but also all |
00002ff0  73 75 62 6d 65 6e 75 73  2e 20 41 6e 64 0a 79 6f  |submenus. And.yo|
00003000  75 20 68 61 76 65 20 74  6f 20 72 65 6d 65 6d 62  |u have to rememb|
00003010  65 72 20 74 68 65 20 68  61 6e 64 6c 65 73 20 6f  |er the handles o|
00003020  66 20 61 6c 6c 20 73 75  62 6d 65 6e 75 73 20 69  |f all submenus i|
00003030  6e 20 6f 72 64 65 72 20  74 6f 20 6c 69 6e 6b 20  |n order to link |
00003040  74 68 65 6d 0a 6c 61 74  65 72 20 74 6f 20 63 6f  |them.later to co|
00003050  72 72 65 73 70 6f 6e 64  69 6e 67 20 6d 65 6e 75  |rresponding menu|
00003060  20 69 74 65 6d 73 20 69  6e 20 70 61 72 65 6e 74  | items in parent|
00003070  20 6d 65 6e 75 2e 20 49  66 20 6f 6e 20 74 68 65  | menu. If on the|
00003080  20 6f 74 68 65 72 20 68  61 6e 64 0a 79 6f 75 72  | other hand.your|
00003090  20 70 72 6f 67 72 61 6d  20 68 61 76 65 20 6f 6e  | program have on|
000030a0  6c 79 20 6f 6e 65 20 6d  65 6e 75 20 77 69 74 68  |ly one menu with|
000030b0  6f 75 74 20 73 75 62 6d  65 6e 75 73 20 74 68 65  |out submenus the|
000030c0  6e 20 79 6f 75 20 6d 61  79 20 69 67 6e 6f 72 65  |n you may ignore|
000030d0  0a 74 68 65 20 72 65 74  75 72 6e 65 64 20 6d 65  |.the returned me|
000030e0  6e 75 20 68 61 6e 64 6c  65 20 62 65 63 61 75 73  |nu handle becaus|
000030f0  65 20 69 74 20 77 69 6c  6c 20 62 65 20 61 6e 79  |e it will be any|
00003100  77 61 79 20 75 73 65 64  20 61 73 20 64 65 66 61  |way used as defa|
00003110  75 6c 74 20 69 6e 0a 61  6c 6c 20 66 75 74 75 72  |ult in.all futur|
00003120  65 20 63 61 6c 6c 73 20  74 6f 20 4d 65 6e 75 55  |e calls to MenuU|
00003130  74 69 6c 73 2e 0a 0a 41  66 74 65 72 20 74 68 69  |tils...After thi|
00003140  73 20 63 61 6c 6c 20 74  68 65 20 6e 65 77 20 6d  |s call the new m|
00003150  65 6e 75 20 62 65 63 6f  6d 65 73 20 74 68 65 20  |enu becomes the |
00003160  63 75 72 72 65 6e 74 20  6d 65 6e 75 2e 0a 0a 3c  |current menu...<|
00003170  45 78 61 6d 70 6c 65 20  63 6f 64 65 2e 2e 2e 3d  |Example code...=|
00003180  3e 45 78 5f 4e 65 77 3e  45 78 61 6d 70 6c 65 20  |>Ex_New>Example |
00003190  63 6f 64 65 20 28 4d 65  6e 75 55 74 69 6c 5f 4e  |code (MenuUtil_N|
000031a0  65 77 29 0a 53 74 61 72  74 20 63 6f 6e 73 74 72  |ew).Start constr|
000031b0  75 63 74 69 6f 6e 20 6f  66 20 73 69 6d 70 6c 65  |uction of simple|
000031c0  20 6d 65 6e 75 20 6c 69  6b 65 20 6f 6e 65 20 69  | menu like one i|
000031d0  6e 20 50 61 6c 65 74 74  65 20 55 74 69 6c 69 74  |n Palette Utilit|
000031e0  79 0a 0a 20 20 53 59 53  20 22 4d 65 6e 75 55 74  |y..  SYS "MenuUt|
000031f0  69 6c 5f 4e 65 77 22 2c  2c 22 50 61 6c 65 74 74  |il_New",,"Palett|
00003200  65 22 20 0a 0a 49 66 20  79 6f 75 20 70 72 6f 67  |e" ..If you prog|
00003210  72 61 6d 20 68 61 73 20  63 6f 6d 70 6c 65 78 20  |ram has complex |
00003220  6d 65 6e 75 20 73 74 72  75 63 74 75 72 65 20 28  |menu structure (|
00003230  6c 69 6b 65 20 53 6f 75  72 63 65 20 45 64 69 74  |like Source Edit|
00003240  6f 72 29 20 74 68 65 6e  20 79 6f 75 0a 68 61 76  |or) then you.hav|
00003250  65 20 74 6f 20 72 65 6d  65 6d 62 65 72 20 74 68  |e to remember th|
00003260  65 20 68 61 6e 64 6c 65  73 20 6f 66 20 61 6c 6c  |e handles of all|
00003270  20 73 75 62 6d 65 6e 75  73 0a 0a 20 20 53 59 53  | submenus..  SYS|
00003280  20 22 4d 65 6e 75 55 74  69 6c 5f 4e 65 77 22 2c  | "MenuUtil_New",|
00003290  2c 22 53 72 63 45 64 69  74 22 20 54 4f 20 6d 61  |,"SrcEdit" TO ma|
000032a0  69 6e 4d 65 6e 75 25 0a  20 20 53 59 53 20 22 4d  |inMenu%.  SYS "M|
000032b0  65 6e 75 55 74 69 6c 5f  4e 65 77 22 2c 2c 22 44  |enuUtil_New",,"D|
000032c0  69 73 70 6c 61 79 22 20  54 4f 20 64 69 73 70 4d  |isplay" TO dispM|
000032d0  65 6e 75 25 0a 20 20 53  59 53 20 22 4d 65 6e 75  |enu%.  SYS "Menu|
000032e0  55 74 69 6c 5f 4e 65 77  22 2c 2c 22 46 6f 6e 74  |Util_New",,"Font|
000032f0  73 22 2c 32 30 30 20 20  54 4f 20 66 6f 6e 74 73  |s",200  TO fonts|
00003300  4d 65 6e 75 25 45 78 61  6d 70 6c 65 20 63 6f 64  |Menu%Example cod|
00003310  65 20 28 4d 65 6e 75 55  74 69 6c 5f 49 6e 69 74  |e (MenuUtil_Init|
00003320  69 61 6c 69 73 65 29 0a  52 65 67 69 73 74 65 72  |ialise).Register|
00003330  20 74 68 65 20 74 61 73  6b 20 77 69 74 68 20 61  | the task with a|
00003340  6e 79 20 76 65 72 73 69  6f 6e 20 6f 66 20 74 68  |ny version of th|
00003350  65 20 6d 6f 64 75 6c 65  0a 0a 53 59 53 20 22 4d  |e module..SYS "M|
00003360  65 6e 75 55 74 69 6c 5f  49 6e 69 74 69 61 6c 69  |enuUtil_Initiali|
00003370  73 65 22 4d 65 6e 75 55  74 69 6c 5f 41 64 64 20  |se"MenuUtil_Add |
00003380  28 53 57 49 20 26 34 35  42 43 32 29 0a 41 64 64  |(SWI &45BC2).Add|
00003390  73 20 6e 65 77 20 69 74  65 6d 20 74 6f 20 65 78  |s new item to ex|
000033a0  69 73 74 69 6e 67 20 6d  65 6e 75 2e 0a 0a 45 6e  |isting menu...En|
000033b0  74 72 79 3a 0a 20 20 20  20 52 30 20 68 61 6e 64  |try:.    R0 hand|
000033c0  6c 65 20 6f 66 20 74 68  65 20 6d 65 6e 75 20 6f  |le of the menu o|
000033d0  72 20 6f 66 20 74 68 65  20 6d 65 6e 75 20 69 74  |r of the menu it|
000033e0  65 6d 20 6f 72 20 7a 65  72 6f 20 66 6f 72 20 63  |em or zero for c|
000033f0  75 72 72 65 6e 74 20 6d  65 6e 75 0a 20 20 20 20  |urrent menu.    |
00003400  52 31 20 70 6f 69 6e 74  65 72 20 74 6f 20 69 74  |R1 pointer to it|
00003410  65 6d 20 74 65 78 74 0a  20 20 20 20 52 32 20 70  |em text.    R2 p|
00003420  6f 69 6e 74 65 72 20 74  6f 20 69 74 65 6d 20 68  |ointer to item h|
00003430  61 6e 64 6c 65 72 0a 0a  45 78 69 74 3a 0a 20 20  |andler..Exit:.  |
00003440  20 20 52 30 20 68 61 6e  64 6c 65 20 6f 66 20 6d  |  R0 handle of m|
00003450  65 6e 75 20 69 74 65 6d  0a 20 20 20 20 52 31 2c  |enu item.    R1,|
00003460  52 32 20 70 72 65 73 65  72 76 65 64 0a 0a 0a 54  |R2 preserved...T|
00003470  68 69 73 20 63 61 6c 6c  20 61 64 64 73 20 6f 6e  |his call adds on|
00003480  65 20 69 74 65 6d 20 74  6f 20 74 68 65 20 65 78  |e item to the ex|
00003490  69 73 74 69 6e 67 20 6d  65 6e 75 2e 20 49 66 20  |isting menu. If |
000034a0  68 61 6e 64 6c 65 20 69  73 20 74 68 65 20 68 61  |handle is the ha|
000034b0  6e 64 6c 65 0a 6f 66 20  6d 65 6e 75 20 74 68 65  |ndle.of menu the|
000034c0  6e 20 6e 65 77 20 69 74  65 6d 20 77 69 6c 6c 20  |n new item will |
000034d0  62 65 20 61 64 64 65 64  20 74 6f 20 74 68 65 20  |be added to the |
000034e0  65 6e 64 20 6f 66 20 74  68 69 73 20 6d 65 6e 75  |end of this menu|
000034f0  2e 20 49 66 20 68 61 6e  64 6c 65 0a 69 73 20 74  |. If handle.is t|
00003500  68 65 20 68 61 6e 64 6c  65 20 6f 66 20 74 68 65  |he handle of the|
00003510  20 69 74 65 6d 20 74 68  65 6e 20 6e 65 77 20 69  | item then new i|
00003520  74 65 6d 20 77 69 6c 6c  20 62 65 20 69 6e 73 65  |tem will be inse|
00003530  72 74 65 64 20 69 6e 74  6f 20 6d 65 6e 75 0a 6a  |rted into menu.j|
00003540  75 73 74 20 62 65 66 6f  72 65 20 74 68 69 73 20  |ust before this |
00003550  69 74 65 6d 2e 20 49 66  20 52 30 20 69 73 20 7a  |item. If R0 is z|
00003560  65 72 6f 20 6f 6e 20 65  6e 74 72 79 20 74 68 65  |ero on entry the|
00003570  6e 20 69 74 65 6d 20 77  69 6c 6c 20 62 65 20 61  |n item will be a|
00003580  64 64 65 64 0a 74 6f 20  74 68 65 20 65 6e 64 20  |dded.to the end |
00003590  6f 66 20 63 75 72 72 65  6e 74 20 6d 65 6e 75 2e  |of current menu.|
000035a0  0a 0a 44 75 72 69 6e 67  20 74 68 69 73 20 63 61  |..During this ca|
000035b0  6c 6c 20 74 68 65 20 63  75 72 72 65 6e 74 20 6d  |ll the current m|
000035c0  65 6e 75 20 6d 61 79 20  62 65 20 6d 6f 76 65 64  |enu may be moved|
000035d0  20 69 6e 20 6d 65 6d 6f  72 79 20 73 6f 20 69 66  | in memory so if|
000035e0  20 79 6f 75 0a 6b 65 65  70 20 64 69 72 65 63 74  | you.keep direct|
000035f0  20 70 6f 69 6e 74 65 72  73 20 74 6f 20 74 68 65  | pointers to the|
00003600  20 6d 65 6e 75 20 64 61  74 61 20 73 74 72 75 63  | menu data struc|
00003610  74 75 72 65 20 74 68 65  79 20 6d 61 79 20 62 65  |ture they may be|
00003620  63 6f 6d 65 0a 69 6e 76  61 6c 69 64 2e 20 4f 6e  |come.invalid. On|
00003630  20 74 68 65 20 6f 74 68  65 72 20 68 61 6e 64 20  | the other hand |
00003640  69 66 20 74 68 65 72 65  20 61 72 65 20 61 6e 79  |if there are any|
00003650  20 6d 65 6e 75 20 69 74  65 6d 73 20 6c 69 6e 6b  | menu items link|
00003660  65 64 20 77 69 74 68 0a  74 68 69 73 20 6d 65 6e  |ed with.this men|
00003670  75 20 62 79 20 6d 65 61  6e 73 20 6f 66 20 3c 4d  |u by means of <M|
00003680  65 6e 75 55 74 69 6c 5f  53 75 62 6d 65 6e 75 3e  |enuUtil_Submenu>|
00003690  20 74 68 65 6e 20 61 6c  6c 20 70 6f 69 6e 74 65  | then all pointe|
000036a0  72 73 20 77 69 6c 6c 20  62 65 0a 72 65 63 61 6c  |rs will be.recal|
000036b0  63 75 6c 61 74 65 64 20  61 75 74 6f 6d 61 74 69  |culated automati|
000036c0  63 61 6c 6c 79 20 62 79  20 74 68 65 20 6d 6f 64  |cally by the mod|
000036d0  75 6c 65 20 61 6e 64 20  77 69 6c 6c 20 72 65 6d  |ule and will rem|
000036e0  61 69 6e 20 76 61 6c 69  64 2e 0a 0a 4d 65 6e 75  |ain valid...Menu|
000036f0  55 74 69 6c 73 20 6d 61  6b 65 73 20 68 69 73 20  |Utils makes his |
00003700  6f 77 6e 20 63 6f 70 79  20 6f 66 20 74 68 65 20  |own copy of the |
00003710  73 74 72 69 6e 67 20 70  6f 69 6e 74 65 64 20 74  |string pointed t|
00003720  6f 20 62 79 20 52 31 20  62 75 74 0a 69 6e 73 70  |o by R1 but.insp|
00003730  69 74 65 20 6f 66 20 74  68 69 73 20 79 6f 75 20  |ite of this you |
00003740  73 74 69 6c 6c 20 63 61  6e 20 65 61 73 69 6c 79  |still can easily|
00003750  20 63 68 61 6e 67 65 20  69 74 20 77 69 74 68 20  | change it with |
00003760  3c 4d 65 6e 75 55 74 69  6c 5f 54 65 78 74 3e 2e  |<MenuUtil_Text>.|
00003770  20 49 66 20 52 31 0a 69  73 20 7a 65 72 6f 20 6f  | If R1.is zero o|
00003780  6e 20 65 6e 74 72 79 20  74 68 65 6e 20 6e 75 6c  |n entry then nul|
00003790  6c 20 73 74 72 69 6e 67  20 28 22 22 29 20 77 69  |l string ("") wi|
000037a0  6c 6c 20 62 65 20 75 73  65 64 20 61 73 20 69 74  |ll be used as it|
000037b0  65 6d 20 74 65 78 74 2e  0a 0a 49 66 20 52 32 20  |em text...If R2 |
000037c0  69 73 20 6e 6f 74 20 7a  65 72 6f 20 6f 6e 20 65  |is not zero on e|
000037d0  6e 74 72 79 20 74 68 65  6e 20 69 6e 74 65 72 70  |ntry then interp|
000037e0  72 65 74 61 74 69 6f 6e  20 6f 66 20 69 74 20 63  |retation of it c|
000037f0  6f 6e 74 65 6e 74 73 20  64 65 70 65 6e 64 73 0a  |ontents depends.|
00003800  6f 6e 20 74 68 65 20 69  6e 69 74 69 61 6c 69 73  |on the initialis|
00003810  61 74 69 6f 6e 20 74 79  70 65 20 73 70 65 63 69  |ation type speci|
00003820  66 69 65 64 20 65 61 72  6c 79 20 64 75 72 69 6e  |fied early durin|
00003830  67 20 74 68 65 20 63 61  6c 6c 20 74 6f 0a 3c 4d  |g the call to.<M|
00003840  65 6e 75 55 74 69 6c 5f  49 6e 69 74 69 61 6c 69  |enuUtil_Initiali|
00003850  73 65 3e 2e 20 49 66 20  69 6e 69 74 69 61 6c 69  |se>. If initiali|
00003860  73 61 74 69 6f 6e 20 74  79 70 65 20 77 61 73 20  |sation type was |
00003870  73 70 65 63 69 66 69 65  64 20 61 73 20 22 42 41  |specified as "BA|
00003880  53 49 43 22 20 74 68 65  6e 0a 69 74 20 69 73 20  |SIC" then.it is |
00003890  61 73 73 75 6d 65 64 20  74 68 61 74 20 52 32 20  |assumed that R2 |
000038a0  69 73 20 61 20 70 6f 69  6e 74 65 72 20 74 6f 20  |is a pointer to |
000038b0  74 68 65 20 63 74 72 6c  2d 74 65 72 6d 69 6e 61  |the ctrl-termina|
000038c0  74 65 64 20 74 65 78 74  20 73 74 72 69 6e 67 2e  |ted text string.|
000038d0  0a 49 6e 20 74 68 69 73  20 63 61 73 65 20 74 68  |.In this case th|
000038e0  65 20 6d 6f 64 75 6c 65  20 6d 61 6b 65 73 20 68  |e module makes h|
000038f0  69 73 20 6f 77 6e 20 63  6f 70 79 20 6f 66 20 74  |is own copy of t|
00003900  68 65 20 73 74 72 69 6e  67 20 66 6f 72 20 6c 61  |he string for la|
00003910  74 65 72 20 75 73 65 0a  69 6e 20 3c 4d 65 6e 75  |ter use.in <Menu|
00003920  55 74 69 6c 5f 44 65 63  6f 64 65 3e 2e 20 49 66  |Util_Decode>. If|
00003930  20 69 6e 69 74 69 61 6c  69 73 61 74 69 6f 6e 20  | initialisation |
00003940  74 79 70 65 20 77 61 73  20 22 6d 61 63 68 69 6e  |type was "machin|
00003950  65 20 63 6f 64 65 22 20  28 6e 6f 74 0a 73 75 70  |e code" (not.sup|
00003960  70 6f 72 74 65 64 20 62  79 20 63 75 72 72 65 6e  |ported by curren|
00003970  74 20 76 65 72 73 69 6f  6e 29 20 74 68 65 6e 20  |t version) then |
00003980  6f 6e 6c 79 20 74 68 65  20 63 6f 6e 74 65 6e 74  |only the content|
00003990  73 20 6f 66 20 52 32 20  69 73 20 73 61 76 65 64  |s of R2 is saved|
000039a0  20 62 79 0a 74 68 65 20  6d 6f 64 75 6c 65 2e 20  | by.the module. |
000039b0  54 68 69 73 20 66 65 61  74 75 72 65 20 61 6c 6c  |This feature all|
000039c0  6f 77 73 20 79 6f 75 20  74 6f 20 61 74 74 61 63  |ows you to attac|
000039d0  68 20 61 20 68 61 6e 64  6c 65 72 20 74 6f 20 74  |h a handler to t|
000039e0  68 65 20 6d 65 6e 75 0a  69 74 65 6d 2e 20 49 6e  |he menu.item. In|
000039f0  20 63 61 73 65 20 6f 66  20 22 42 41 53 49 43 22  | case of "BASIC"|
00003a00  20 79 6f 75 20 63 61 6e  20 70 72 6f 76 69 64 65  | you can provide|
00003a10  20 74 68 65 20 6e 61 6d  65 20 6f 66 20 42 41 53  | the name of BAS|
00003a20  49 43 20 66 75 6e 63 74  69 6f 6e 2e 0a 49 6e 20  |IC function..In |
00003a30  63 61 73 65 20 6f 66 20  22 6d 61 63 68 69 6e 65  |case of "machine|
00003a40  20 63 6f 64 65 22 20 2d  20 74 68 65 20 61 64 64  | code" - the add|
00003a50  72 65 73 73 20 6f 66 20  41 52 4d 20 73 75 62 72  |ress of ARM subr|
00003a60  6f 75 74 69 6e 65 2e 20  53 65 65 20 61 6c 73 6f  |outine. See also|
00003a70  0a 3c 4d 65 6e 75 55 74  69 6c 5f 44 65 63 6f 64  |.<MenuUtil_Decod|
00003a80  65 3e 20 61 6e 64 20 66  6f 72 20 70 6f 73 73 69  |e> and for possi|
00003a90  62 6c 65 20 75 73 65 20  6f 66 20 69 74 65 6d 20  |ble use of item |
00003aa0  68 61 6e 64 6c 65 72 73  2e 0a 20 20 20 20 20 20  |handlers..      |
00003ab0  20 20 20 20 20 20 20 20  20 0a 3c 45 78 61 6d 70  |         .<Examp|
00003ac0  6c 65 20 63 6f 64 65 2e  2e 2e 3d 3e 45 78 5f 41  |le code...=>Ex_A|
00003ad0  64 64 3e 45 78 61 6d 70  6c 65 20 63 6f 64 65 20  |dd>Example code |
00003ae0  28 4d 65 6e 75 55 74 69  6c 5f 41 64 64 29 0a 41  |(MenuUtil_Add).A|
00003af0  64 64 20 69 74 65 6d 20  22 49 6e 66 6f 22 20 74  |dd item "Info" t|
00003b00  6f 20 74 68 65 20 63 75  72 72 65 6e 74 20 6d 65  |o the current me|
00003b10  6e 75 0a 0a 20 20 53 59  53 20 22 4d 65 6e 75 55  |nu..  SYS "MenuU|
00003b20  74 69 6c 5f 41 64 64 22  2c 2c 22 49 6e 66 6f 22  |til_Add",,"Info"|
00003b30  20 54 4f 20 69 6e 66 6f  49 74 65 6d 25 0a 0a 41  | TO infoItem%..A|
00003b40  64 64 20 69 74 65 6d 20  22 51 75 69 74 22 20 61  |dd item "Quit" a|
00003b50  6e 64 20 74 68 65 6e 20  69 6e 73 65 72 74 20 69  |nd then insert i|
00003b60  74 65 6d 20 22 43 72 65  61 74 65 22 20 6a 75 73  |tem "Create" jus|
00003b70  74 20 62 65 66 6f 72 65  20 69 74 2e 20 20 4c 65  |t before it.  Le|
00003b80  74 27 73 0a 74 68 65 20  66 69 72 73 74 20 69 74  |t's.the first it|
00003b90  65 6d 20 77 69 6c 6c 20  68 61 76 65 20 74 68 65  |em will have the|
00003ba0  20 68 61 6e 64 6c 65 72  2e 20 54 68 65 20 68 61  | handler. The ha|
00003bb0  6e 64 6c 65 72 20 69 73  20 61 73 73 75 6d 65 64  |ndler is assumed|
00003bc0  20 74 6f 20 62 65 0a 42  41 53 49 43 20 66 75 6e  | to be.BASIC fun|
00003bd0  63 74 69 6f 6e 20 46 4e  71 75 69 74 2e 20 28 53  |ction FNquit. (S|
00003be0  65 65 20 3c 4d 65 6e 75  55 74 69 6c 5f 44 65 63  |ee <MenuUtil_Dec|
00003bf0  6f 64 65 3e 20 6f 6e 20  68 6f 77 20 74 68 69 73  |ode> on how this|
00003c00  20 68 61 6e 64 6c 65 72  20 6d 61 79 20 62 65 0a  | handler may be.|
00003c10  63 61 6c 6c 65 64 29 0a  0a 20 20 53 59 53 20 22  |called)..  SYS "|
00003c20  4d 65 6e 75 55 74 69 6c  5f 41 64 64 22 2c 2c 22  |MenuUtil_Add",,"|
00003c30  51 75 69 74 22 2c 22 71  75 69 74 22 20 54 4f 20  |Quit","quit" TO |
00003c40  71 75 69 74 49 74 65 6d  25 0a 20 20 53 59 53 20  |quitItem%.  SYS |
00003c50  22 4d 65 6e 75 55 74 69  6c 5f 41 64 64 22 2c 71  |"MenuUtil_Add",q|
00003c60  75 69 74 49 74 65 6d 25  2c 22 43 72 65 61 74 65  |uitItem%,"Create|
00003c70  22 20 54 4f 20 63 72 65  61 74 65 49 74 65 6d 25  |" TO createItem%|
00003c80  0a 20 20 0a 43 72 65 61  74 65 20 6d 65 6e 75 20  |.  .Create menu |
00003c90  73 69 6d 69 6c 61 72 20  74 6f 20 44 69 73 70 6c  |similar to Displ|
00003ca0  61 79 20 73 75 62 6d 65  6e 75 20 69 6e 20 46 69  |ay submenu in Fi|
00003cb0  6c 65 72 2e 20 57 68 65  6e 20 69 74 65 6d 73 20  |ler. When items |
00003cc0  61 72 65 20 61 64 64 65  64 0a 74 6f 20 63 75 72  |are added.to cur|
00003cd0  72 65 6e 74 20 6d 65 6e  75 20 6d 65 6e 75 20 68  |rent menu menu h|
00003ce0  61 6e 64 6c 65 20 28 64  69 73 70 4d 65 6e 75 25  |andle (dispMenu%|
00003cf0  29 20 6d 61 79 20 62 65  20 6f 6d 69 74 74 65 64  |) may be omitted|
00003d00  20 61 73 20 69 74 20 77  69 6c 6c 20 62 65 0a 75  | as it will be.u|
00003d10  73 65 64 20 62 79 20 64  65 66 61 75 6c 74 2e 0a  |sed by default..|
00003d20  0a 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |. SYS "MenuUtil_|
00003d30  4e 65 77 22 2c 2c 22 44  69 73 70 6c 61 79 22 20  |New",,"Display" |
00003d40  54 4f 20 64 69 73 70 4d  65 6e 75 25 0a 20 53 59  |TO dispMenu%. SY|
00003d50  53 20 22 4d 65 6e 75 55  74 69 6c 5f 41 64 64 22  |S "MenuUtil_Add"|
00003d60  2c 2c 22 4c 61 72 67 65  20 69 63 6f 6e 73 22 20  |,,"Large icons" |
00003d70  54 4f 20 6c 61 72 67 65  49 74 65 6d 25 0a 20 53  |TO largeItem%. S|
00003d80  59 53 20 22 4d 65 6e 75  55 74 69 6c 5f 41 64 64  |YS "MenuUtil_Add|
00003d90  22 2c 2c 22 53 6d 61 6c  6c 20 69 63 6f 6e 73 22  |",,"Small icons"|
00003da0  20 54 4f 20 73 6d 61 6c  6c 49 74 65 6d 25 0a 20  | TO smallItem%. |
00003db0  53 59 53 20 22 4d 65 6e  75 55 74 69 6c 5f 41 64  |SYS "MenuUtil_Ad|
00003dc0  64 22 2c 2c 22 46 75 6c  6c 20 69 6e 66 6f 22 20  |d",,"Full info" |
00003dd0  54 4f 20 66 75 6c 6c 49  74 65 6d 25 65 6e 75 55  |TO fullItem%enuU|
00003de0  74 69 6c 5f 44 65 6c 65  74 65 20 28 53 57 49 20  |til_Delete (SWI |
00003df0  26 34 35 42 43 33 29 0a  52 65 6d 6f 76 65 73 20  |&45BC3).Removes |
00003e00  6d 65 6e 75 20 6f 72 20  6d 65 6e 75 20 69 74 65  |menu or menu ite|
00003e10  6d 0a 0a 45 6e 74 72 79  3a 0a 20 20 20 20 52 30  |m..Entry:.    R0|
00003e20  20 3d 20 68 61 6e 64 6c  65 20 6f 66 20 74 68 65  | = handle of the|
00003e30  20 6d 65 6e 75 20 6f 72  20 6f 66 20 74 68 65 20  | menu or of the |
00003e40  6d 65 6e 75 20 69 74 65  6d 20 6f 72 0a 20 20 20  |menu item or.   |
00003e50  20 20 20 20 20 20 7a 65  72 6f 20 66 6f 72 20 63  |      zero for c|
00003e60  75 72 72 65 6e 74 20 6d  65 6e 75 0a 20 20 20 20  |urrent menu.    |
00003e70  69 66 20 52 31 5c 3c 3e  30 20 74 68 65 6e 20 72  |if R1\<>0 then r|
00003e80  65 63 75 72 73 69 76 65  6c 79 20 64 65 6c 65 74  |ecursively delet|
00003e90  65 20 61 6c 6c 20 73 75  62 6d 65 6e 75 73 20 0a  |e all submenus .|
00003ea0  45 78 69 74 3a 0a 20 20  20 20 52 30 2c 52 31 20  |Exit:.    R0,R1 |
00003eb0  70 72 65 73 65 72 76 65  64 0a 0a 54 68 69 73 20  |preserved..This |
00003ec0  63 61 6c 6c 20 61 6c 6c  6f 77 73 20 79 6f 75 20  |call allows you |
00003ed0  74 6f 20 64 65 6c 65 74  65 20 74 68 65 20 77 68  |to delete the wh|
00003ee0  6f 6c 65 20 6d 65 6e 75  20 6f 72 0a 74 68 65 20  |ole menu or.the |
00003ef0  70 61 72 74 69 63 75 6c  61 72 20 6d 65 6e 75 20  |particular menu |
00003f00  69 74 65 6d 2e 20 49 66  20 79 6f 75 20 77 69 6c  |item. If you wil|
00003f10  6c 20 64 65 6c 65 74 65  20 6d 65 6e 75 0a 69 74  |l delete menu.it|
00003f20  65 6d 20 74 68 65 6e 20  72 65 6d 61 69 6e 65 64  |em then remained|
00003f30  20 69 74 65 6d 73 20 6f  66 20 74 68 69 73 20 6d  | items of this m|
00003f40  65 6e 75 20 77 68 69 63  68 20 61 72 65 0a 70 6f  |enu which are.po|
00003f50  73 69 74 69 6f 6e 65 64  20 62 65 6c 6c 6f 77 20  |sitioned bellow |
00003f60  69 74 20 77 69 6c 6c 20  62 65 20 61 75 74 6f 6d  |it will be autom|
00003f70  61 74 69 63 61 6c 6c 79  20 73 68 69 66 74 65 64  |atically shifted|
00003f80  0a 69 6e 20 6d 65 6d 6f  72 79 20 74 6f 20 66 69  |.in memory to fi|
00003f90  6c 6c 20 74 68 65 20 68  6f 6c 65 2e 20 44 65 73  |ll the hole. Des|
00003fa0  70 69 74 65 20 74 68 65  20 66 61 63 74 20 74 68  |pite the fact th|
00003fb0  61 74 0a 6d 65 6d 6f 72  79 20 6c 6f 63 61 74 69  |at.memory locati|
00003fc0  6f 6e 20 61 6e 64 20 70  6f 73 69 74 69 6f 6e 20  |on and position |
00003fd0  69 6e 20 6d 65 6e 75 20  6f 66 20 73 6f 6d 65 20  |in menu of some |
00003fe0  69 74 65 6d 73 0a 6d 61  79 20 62 65 20 63 68 61  |items.may be cha|
00003ff0  6e 67 65 64 20 74 68 65  20 68 61 6e 64 6c 65 73  |nged the handles|
00004000  20 6f 66 20 74 68 65 20  69 74 65 6d 73 20 77 69  | of the items wi|
00004010  6c 6c 20 72 65 6d 61 69  6e 0a 76 61 6c 69 64 2e  |ll remain.valid.|
00004020  0a 0a 49 66 20 79 6f 75  20 77 61 6e 74 20 74 6f  |..If you want to|
00004030  20 64 65 6c 65 74 65 20  6e 6f 74 20 6f 6e 6c 79  | delete not only|
00004040  20 74 68 65 20 69 74 65  6d 20 62 75 74 20 61 6c  | the item but al|
00004050  73 6f 20 74 68 65 0a 77  68 6f 6c 65 20 6d 65 6e  |so the.whole men|
00004060  75 20 73 75 62 74 72 65  65 20 63 6f 6e 6e 65 63  |u subtree connec|
00004070  74 65 64 20 77 69 74 68  20 69 74 20 74 68 65 6e  |ted with it then|
00004080  20 79 6f 75 20 6d 75 73  74 0a 73 65 74 20 52 31  | you must.set R1|
00004090  5c 3c 3e 30 20 6f 6e 20  65 6e 74 72 79 2e 20 49  |\<>0 on entry. I|
000040a0  66 20 52 30 20 63 6f 6e  74 61 69 6e 73 20 74 68  |f R0 contains th|
000040b0  65 20 68 61 6e 64 6c 65  20 6f 66 0a 6d 65 6e 75  |e handle of.menu|
000040c0  20 74 68 65 6e 20 74 68  69 73 20 6d 65 6e 75 20  | then this menu |
000040d0  77 69 6c 6c 20 62 65 20  64 65 6c 65 74 65 64 20  |will be deleted |
000040e0  61 6c 6f 6e 65 20 6f 72  20 74 6f 67 65 74 68 65  |alone or togethe|
000040f0  72 0a 77 69 74 68 20 61  6c 6c 20 73 75 62 6d 65  |r.with all subme|
00004100  6e 75 73 20 64 65 70 65  6e 64 69 6e 67 20 6f 6e  |nus depending on|
00004110  20 52 31 2e 20 0a 0a 55  73 65 20 72 65 63 75 72  | R1. ..Use recur|
00004120  73 69 76 65 20 64 65 6c  65 74 69 6f 6e 20 77 69  |sive deletion wi|
00004130  74 68 20 63 61 75 74 69  6f 6e 20 61 73 20 79 6f  |th caution as yo|
00004140  75 20 6d 61 79 0a 61 63  63 69 64 65 6e 74 61 6c  |u may.accidental|
00004150  6c 79 20 64 65 6c 65 74  65 20 73 75 62 6d 65 6e  |ly delete submen|
00004160  75 73 20 77 68 69 63 68  20 61 72 65 20 63 6f 6e  |us which are con|
00004170  6e 65 63 74 65 64 20 77  69 74 68 0a 6f 74 68 65  |nected with.othe|
00004180  72 20 6d 65 6e 75 20 69  74 65 6d 73 2e 0a 0a 54  |r menu items...T|
00004190  68 69 73 20 63 61 6c 6c  20 69 73 20 73 75 70 70  |his call is supp|
000041a0  6f 73 65 64 20 74 6f 20  62 65 20 75 73 65 64 20  |osed to be used |
000041b0  77 68 65 6e 20 6d 65 6e  75 73 20 77 69 74 68 0a  |when menus with.|
000041c0  76 61 72 69 61 62 6c 65  20 6e 75 6d 62 65 72 20  |variable number |
000041d0  6f 66 20 69 74 65 6d 73  20 61 72 65 20 6e 65 65  |of items are nee|
000041e0  64 65 64 2e 20 49 74 20  6d 61 79 20 62 65 20 66  |ded. It may be f|
000041f0  6f 72 0a 65 78 61 6d 70  6c 65 20 6d 65 6e 75 20  |or.example menu |
00004200  77 69 74 68 20 74 68 65  20 6c 69 73 74 20 6f 66  |with the list of|
00004210  20 63 75 72 72 65 6e 74  6c 79 20 6f 70 65 6e 65  | currently opene|
00004220  64 20 64 6f 63 75 6d 65  6e 74 73 0a 6f 72 20 61  |d documents.or a|
00004230  72 63 68 69 76 65 73 2e  0a 0a 3c 45 78 61 6d 70  |rchives...<Examp|
00004240  6c 65 20 63 6f 64 65 2e  2e 2e 3d 3e 45 78 5f 44  |le code...=>Ex_D|
00004250  65 6c 65 74 65 3e 45 78  61 6d 70 6c 65 20 63 6f  |elete>Example co|
00004260  64 65 20 28 4d 65 6e 75  55 74 69 6c 5f 44 65 6c  |de (MenuUtil_Del|
00004270  65 74 65 29 0a 44 65 6c  65 74 65 20 69 74 65 6d  |ete).Delete item|
00004280  20 77 69 74 68 20 68 61  6e 64 6c 65 20 74 6d 70  | with handle tmp|
00004290  49 74 65 6d 25 3a 0a 0a  20 20 53 59 53 20 22 4d  |Item%:..  SYS "M|
000042a0  65 6e 75 55 74 69 6c 5f  44 65 6c 65 74 65 22 2c  |enuUtil_Delete",|
000042b0  74 6d 70 49 74 65 6d 25  0a 0a 52 65 63 75 72 73  |tmpItem%..Recurs|
000042c0  69 76 65 6c 79 20 64 65  6c 65 74 65 20 61 6c 6c  |ively delete all|
000042d0  20 6d 65 6e 75 73 20 6c  69 6e 6b 65 64 20 77 69  | menus linked wi|
000042e0  74 68 20 6d 61 69 6e 4d  65 6e 75 25 3a 0a 20 0a  |th mainMenu%:. .|
000042f0  20 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |  SYS "MenuUtil_|
00004300  44 65 6c 65 74 65 22 2c  6d 61 69 6e 4d 65 6e 75  |Delete",mainMenu|
00004310  25 2c 54 52 55 45 4d 65  6e 75 55 74 69 6c 5f 44  |%,TRUEMenuUtil_D|
00004320  65 63 6f 64 65 20 28 53  57 49 20 26 34 35 42 43  |ecode (SWI &45BC|
00004330  34 29 0a 44 65 63 6f 64  65 73 20 6d 65 6e 75 20  |4).Decodes menu |
00004340  61 66 74 65 72 20 75 73  65 72 20 73 65 6c 65 63  |after user selec|
00004350  74 69 6f 6e 2e 0a 0a 45  6e 74 72 79 3a 0a 0a 20  |tion...Entry:.. |
00004360  20 20 20 52 30 20 3d 20  6d 65 6e 75 20 68 61 6e  |   R0 = menu han|
00004370  64 6c 65 20 6f 72 20 7a  65 72 6f 20 69 66 20 63  |dle or zero if c|
00004380  75 72 72 65 6e 74 20 6d  65 6e 75 0a 20 20 20 20  |urrent menu.    |
00004390  52 31 20 2d 3e 20 70 6f  69 6e 74 65 72 20 74 6f  |R1 -> pointer to|
000043a0  20 74 68 65 20 6c 69 73  74 20 6f 66 20 6d 65 6e  | the list of men|
000043b0  75 20 73 65 6c 65 63 74  69 6f 6e 73 0a 45 78 69  |u selections.Exi|
000043c0  74 3a 0a 20 20 20 20 52  30 20 2d 3e 20 70 6f 69  |t:.    R0 -> poi|
000043d0  6e 74 65 72 20 74 6f 20  69 74 65 6d 20 68 61 6e  |nter to item han|
000043e0  64 6c 65 72 20 6f 72 20  7a 65 72 6f 0a 20 20 20  |dler or zero.   |
000043f0  20 52 31 20 2d 3e 20 54  52 55 45 20 69 66 20 73  | R1 -> TRUE if s|
00004400  65 6c 65 63 74 69 6f 6e  20 77 61 73 20 6d 61 64  |election was mad|
00004410  65 20 77 69 74 68 20 41  44 4a 55 53 54 2e 20 28  |e with ADJUST. (|
00004420  75 6e 64 6f 63 75 6d 65  6e 74 65 64 2c 20 62 75  |undocumented, bu|
00004430  74 0a 20 20 20 20 20 20  20 20 20 20 75 73 65 64  |t.          used|
00004440  20 69 6e 20 21 54 65 6d  70 6c 45 64 29 20 0a 20  | in !TemplEd) . |
00004450  20 20 20 52 32 20 2d 3e  20 70 6f 69 6e 74 65 72  |   R2 -> pointer|
00004460  20 74 6f 20 62 6c 6f 63  6b 20 28 6f 72 69 67 69  | to block (origi|
00004470  6e 61 6c 20 64 6f 63 73  20 73 61 69 64 20 74 68  |nal docs said th|
00004480  69 73 20 77 61 73 20 72  65 74 75 72 6e 65 64 20  |is was returned |
00004490  69 6e 20 52 31 20 2d 0a  20 20 20 20 20 20 20 20  |in R1 -.        |
000044a0  20 20 74 68 69 73 20 61  70 70 65 61 72 73 20 74  |  this appears t|
000044b0  6f 20 62 65 20 69 6e 63  6f 72 72 65 63 74 21 29  |o be incorrect!)|
000044c0  0a 0a 42 6c 6f 63 6b 20  70 6f 69 6e 74 65 64 20  |..Block pointed |
000044d0  74 6f 20 62 79 20 52 31  20 6d 75 73 74 20 63 6f  |to by R1 must co|
000044e0  6e 74 61 69 6e 20 74 68  65 20 6c 69 73 74 20 6f  |ntain the list o|
000044f0  66 20 6d 65 6e 75 20 73  65 6c 65 63 74 69 6f 6e  |f menu selection|
00004500  73 20 69 6e 20 74 68 65  20 73 61 6d 65 0a 66 6f  |s in the same.fo|
00004510  72 6d 61 74 20 61 73 20  72 65 74 75 72 6e 65 64  |rmat as returned|
00004520  20 62 79 20 57 69 6d 70  5f 50 6f 6c 6c 20 69 6e  | by Wimp_Poll in|
00004530  20 63 61 73 65 20 6f 66  20 6d 65 6e 75 20 73 65  | case of menu se|
00004540  6c 65 63 74 69 6f 6e 20  65 76 65 6e 74 2e 20 0a  |lection event. .|
00004550  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00004560  52 31 20 2b 20 30 20 20  69 74 65 6d 20 69 6e 20  |R1 + 0  item in |
00004570  6d 61 69 6e 20 6d 65 6e  75 20 77 68 69 63 68 20  |main menu which |
00004580  77 61 73 20 73 65 6c 65  63 74 65 64 20 28 73 74  |was selected (st|
00004590  61 72 74 69 6e 67 20 66  72 6f 6d 20 30 29 0a 20  |arting from 0). |
000045a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 52 31  |              R1|
000045b0  20 2b 20 34 20 20 69 74  65 6d 20 69 6e 20 66 69  | + 4  item in fi|
000045c0  72 73 74 20 73 75 62 6d  65 6e 75 20 77 68 69 63  |rst submenu whic|
000045d0  68 20 77 61 73 20 73 65  6c 65 63 74 65 64 0a 20  |h was selected. |
000045e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 52 31  |              R1|
000045f0  20 2b 20 38 20 20 69 74  65 6d 20 69 6e 20 73 65  | + 8  item in se|
00004600  63 6f 6e 64 20 73 75 62  6d 65 6e 75 20 77 68 69  |cond submenu whi|
00004610  63 68 20 77 61 73 20 73  65 6c 65 63 74 65 64 0a  |ch was selected.|
00004620  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004630  20 20 20 20 20 20 20 2e  2e 2e 0a 20 20 20 20 20  |       ....     |
00004640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004650  20 20 74 65 72 6d 69 6e  61 74 65 64 20 62 79 20  |  terminated by |
00004660  2d 31 0a 0a 54 68 69 73  20 63 61 6c 6c 20 6d 61  |-1..This call ma|
00004670  70 73 20 74 68 65 20 6c  69 73 74 20 6f 66 20 6d  |ps the list of m|
00004680  65 6e 75 20 73 65 6c 65  63 74 69 6f 6e 73 20 6f  |enu selections o|
00004690  6e 74 6f 20 6d 65 6e 75  20 64 61 74 61 20 73 74  |nto menu data st|
000046a0  72 75 63 74 75 72 65 20  61 6e 64 0a 64 65 74 65  |ructure and.dete|
000046b0  72 6d 69 6e 65 73 20 63  6f 72 72 65 73 70 6f 6e  |rmines correspon|
000046c0  64 69 6e 67 20 6d 65 6e  75 20 69 74 65 6d 73 2e  |ding menu items.|
000046d0  20 56 61 72 69 6f 75 73  20 69 6e 66 6f 72 6d 61  | Various informa|
000046e0  74 69 6f 6e 20 61 62 6f  75 74 20 6c 61 73 74 20  |tion about last |
000046f0  74 77 6f 0a 69 74 65 6d  73 20 66 72 6f 6d 20 74  |two.items from t|
00004700  68 69 73 20 6c 69 73 74  20 28 73 65 6c 65 63 74  |his list (select|
00004710  65 64 20 69 74 65 6d 20  61 6e 64 20 70 61 72 65  |ed item and pare|
00004720  6e 74 20 69 74 65 6d 20  66 72 6f 6d 20 6d 65 6e  |nt item from men|
00004730  75 20 6f 6e 65 20 6c 65  76 65 6c 20 75 70 0a 69  |u one level up.i|
00004740  66 20 61 6e 79 29 20 69  73 20 77 72 69 74 74 65  |f any) is writte|
00004750  6e 20 69 6e 74 6f 20 73  70 65 63 69 61 6c 20 62  |n into special b|
00004760  6c 6f 63 6b 2e 20 50 6f  69 6e 74 65 72 20 74 6f  |lock. Pointer to|
00004770  20 74 68 69 73 20 62 6c  6f 63 6b 20 69 73 20 72  | this block is r|
00004780  65 74 75 72 6e 65 64 20  69 6e 0a 52 32 2e 20 46  |eturned in.R2. F|
00004790  6f 72 6d 61 74 20 6f 66  20 74 68 65 20 72 65 74  |ormat of the ret|
000047a0  75 72 6e 65 64 20 62 6c  6f 63 6b 20 69 73 20 61  |urned block is a|
000047b0  73 20 66 6f 6c 6c 6f 77  73 3a 20 0a 0a 20 52 32  |s follows: .. R2|
000047c0  2b 30 20 20 70 6f 73 69  74 69 6f 6e 20 6f 66 20  |+0  position of |
000047d0  73 65 6c 65 63 74 65 64  20 6d 65 6e 75 20 69 74  |selected menu it|
000047e0  65 6d 20 69 6e 20 6d 65  6e 75 20 28 73 74 61 72  |em in menu (star|
000047f0  74 69 6e 67 20 66 72 6f  6d 20 30 29 0a 20 52 32  |ting from 0). R2|
00004800  2b 34 20 20 70 6f 69 6e  74 65 72 20 74 6f 20 73  |+4  pointer to s|
00004810  65 6c 65 63 74 65 64 20  69 74 65 6d 20 64 61 74  |elected item dat|
00004820  61 0a 20 52 32 2b 38 20  20 73 65 6c 65 63 74 65  |a. R2+8  selecte|
00004830  64 20 69 74 65 6d 20 68  61 6e 64 6c 65 20 6f 72  |d item handle or|
00004840  20 7a 65 72 6f 20 69 66  20 69 74 65 6d 20 77 61  | zero if item wa|
00004850  73 20 63 72 65 61 74 65  64 20 77 69 74 68 6f 75  |s created withou|
00004860  74 20 4d 65 6e 75 55 74  69 6c 73 0a 20 52 32 2b  |t MenuUtils. R2+|
00004870  31 32 20 70 6f 69 6e 74  65 72 20 74 6f 20 74 65  |12 pointer to te|
00004880  78 74 20 73 74 72 69 6e  67 20 6f 66 20 73 65 6c  |xt string of sel|
00004890  65 63 74 65 64 20 69 74  65 6d 0a 20 52 32 2b 31  |ected item. R2+1|
000048a0  36 20 70 6f 73 69 74 69  6f 6e 20 6f 66 20 70 61  |6 position of pa|
000048b0  72 65 6e 74 20 6d 65 6e  75 20 69 74 65 6d 20 69  |rent menu item i|
000048c0  6e 20 6d 65 6e 75 20 28  73 74 61 72 74 69 6e 67  |n menu (starting|
000048d0  20 66 72 6f 6d 20 30 29  0a 20 52 32 2b 32 30 20  | from 0). R2+20 |
000048e0  70 6f 69 6e 74 65 72 20  74 6f 20 70 61 72 65 6e  |pointer to paren|
000048f0  74 20 69 74 65 6d 20 64  61 74 61 0a 20 52 32 2b  |t item data. R2+|
00004900  32 34 20 70 61 72 65 6e  74 20 69 74 65 6d 20 68  |24 parent item h|
00004910  61 6e 64 6c 65 20 6f 72  20 7a 65 72 6f 20 69 66  |andle or zero if|
00004920  20 69 74 65 6d 20 77 61  73 20 63 72 65 61 74 65  | item was create|
00004930  64 20 77 69 74 68 6f 75  74 20 4d 65 6e 75 55 74  |d without MenuUt|
00004940  69 6c 73 0a 20 52 32 2b  32 38 20 70 6f 69 6e 74  |ils. R2+28 point|
00004950  65 72 20 74 6f 20 74 65  78 74 20 73 74 72 69 6e  |er to text strin|
00004960  67 20 6f 66 20 70 61 72  65 6e 74 20 69 74 65 6d  |g of parent item|
00004970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004980  20 20 20 20 20 20 20 20  20 0a 0a 49 66 20 74 68  |         ..If th|
00004990  65 20 69 74 65 6d 20 68  61 73 20 62 65 65 6e 20  |e item has been |
000049a0  73 65 6c 65 63 74 65 64  20 66 72 6f 6d 20 74 68  |selected from th|
000049b0  65 20 74 6f 70 2d 6c 65  76 65 6c 20 6d 65 6e 75  |e top-level menu|
000049c0  20 74 68 65 6e 20 74 68  65 72 65 20 77 69 6c 6c  | then there will|
000049d0  20 62 65 20 6e 6f 0a 70  61 72 65 6e 74 20 69 74  | be no.parent it|
000049e0  65 6d 20 61 6e 64 20 63  6f 72 72 65 73 70 6f 6e  |em and correspon|
000049f0  64 69 6e 67 20 70 61 72  74 20 6f 66 20 74 68 65  |ding part of the|
00004a00  20 62 6c 6f 63 6b 20 77  69 6c 6c 20 62 65 20 66  | block will be f|
00004a10  69 6c 6c 65 64 20 77 69  74 68 20 7a 65 72 6f 73  |illed with zeros|
00004a20  2e 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00004a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00004a70  20 20 20 20 20 20 0a 49  66 20 64 75 72 69 6e 67  |      .If during|
00004a80  20 63 72 65 61 74 69 6f  6e 20 6f 66 20 74 68 69  | creation of thi|
00004a90  73 20 69 74 65 6d 20 79  6f 75 20 68 61 76 65 20  |s item you have |
00004aa0  73 70 65 63 69 66 69 65  64 20 74 68 65 20 68 61  |specified the ha|
00004ab0  6e 64 6c 65 72 20 74 68  65 6e 20 52 30 20 6f 6e  |ndler then R0 on|
00004ac0  0a 65 78 69 74 20 77 69  6c 6c 20 63 6f 6e 74 61  |.exit will conta|
00004ad0  69 6e 20 74 68 65 20 70  6f 69 6e 74 65 72 20 74  |in the pointer t|
00004ae0  6f 20 74 68 69 73 20 68  61 6e 64 6c 65 72 20 6f  |o this handler o|
00004af0  74 68 65 72 77 69 73 65  20 52 30 20 77 69 6c 6c  |therwise R0 will|
00004b00  20 62 65 20 7a 65 72 6f  2e 0a 49 6e 74 65 72 70  | be zero..Interp|
00004b10  72 65 74 61 74 69 6f 6e  20 6f 66 20 69 74 65 6d  |retation of item|
00004b20  20 68 61 6e 64 6c 65 72  20 69 73 20 64 65 74 65  | handler is dete|
00004b30  72 6d 69 6e 65 64 20 62  79 20 69 6e 69 74 69 61  |rmined by initia|
00004b40  6c 69 73 61 74 69 6f 6e  20 74 79 70 65 20 28 73  |lisation type (s|
00004b50  65 65 0a 3c 4d 65 6e 75  55 74 69 6c 5f 49 6e 69  |ee.<MenuUtil_Ini|
00004b60  74 69 61 6c 69 73 65 3e  29 2e 20 49 66 20 69 6e  |tialise>). If in|
00004b70  69 74 69 61 6c 69 73 61  74 69 6f 6e 20 74 79 70  |itialisation typ|
00004b80  65 20 77 61 73 20 22 42  41 53 49 43 22 20 74 68  |e was "BASIC" th|
00004b90  65 6e 20 52 30 20 77 69  6c 6c 0a 70 6f 69 6e 74  |en R0 will.point|
00004ba0  20 74 6f 20 63 74 72 6c  2d 74 65 72 6d 69 6e 61  | to ctrl-termina|
00004bb0  74 65 64 20 74 65 78 74  20 73 74 72 69 6e 67 2e  |ted text string.|
00004bc0  20 49 66 20 69 6e 69 74  69 61 6c 69 73 61 74 69  | If initialisati|
00004bd0  6f 6e 20 74 79 70 65 20  77 61 73 20 22 6d 61 63  |on type was "mac|
00004be0  68 69 6e 65 0a 63 6f 64  65 22 20 28 6e 6f 74 73  |hine.code" (nots|
00004bf0  75 70 70 6f 72 74 65 64  20 62 79 20 63 75 72 72  |upported by curr|
00004c00  65 6e 74 20 76 65 72 73  69 6f 6e 29 20 74 68 65  |ent version) the|
00004c10  6e 20 52 30 20 77 69 6c  6c 20 63 6f 6e 74 61 69  |n R0 will contai|
00004c20  6e 20 74 68 65 20 76 61  6c 75 65 0a 70 61 73 73  |n the value.pass|
00004c30  65 64 20 69 6e 20 52 32  20 74 6f 20 3c 4d 65 6e  |ed in R2 to <Men|
00004c40  75 55 74 69 6c 5f 41 64  64 3e 2e 20 54 6f 20 69  |uUtil_Add>. To i|
00004c50  6e 76 6f 6b 65 20 42 41  53 49 43 20 68 61 6e 64  |nvoke BASIC hand|
00004c60  6c 65 72 20 79 6f 75 20  63 61 6e 20 75 73 65 20  |ler you can use |
00004c70  45 56 41 4c 0a 73 74 61  74 65 6d 65 6e 74 2e 0a  |EVAL.statement..|
00004c80  0a 3c 45 78 61 6d 70 6c  65 20 63 6f 64 65 2e 2e  |.<Example code..|
00004c90  2e 3d 3e 45 78 5f 44 65  63 6f 64 65 3e 45 78 61  |.=>Ex_Decode>Exa|
00004ca0  6d 70 6c 65 20 63 6f 64  65 20 28 4d 65 6e 75 55  |mple code (MenuU|
00004cb0  74 69 6c 5f 44 65 63 6f  64 65 29 0a 53 75 70 70  |til_Decode).Supp|
00004cc0  6f 73 65 20 57 69 6d 70  5f 50 6f 6c 6c 20 68 61  |ose Wimp_Poll ha|
00004cd0  73 20 72 65 74 75 72 6e  65 64 20 72 65 61 73 6f  |s returned reaso|
00004ce0  6e 20 63 6f 64 65 20 39  20 28 4d 65 6e 75 5f 53  |n code 9 (Menu_S|
00004cf0  65 6c 65 63 74 69 6f 6e  29 20 61 6e 64 20 71 25  |election) and q%|
00004d00  0a 70 6f 69 6e 74 73 20  74 6f 20 74 68 65 20 63  |.points to the c|
00004d10  6f 72 72 65 73 70 6f 6e  64 69 6e 67 20 62 6c 6f  |orresponding blo|
00004d20  63 6b 2e 20 59 6f 75 20  63 61 6e 20 75 73 65 20  |ck. You can use |
00004d30  4d 65 6e 75 55 74 69 6c  5f 44 65 63 6f 64 65 20  |MenuUtil_Decode |
00004d40  74 6f 20 63 61 6c 6c 20  74 68 65 0a 69 74 65 6d  |to call the.item|
00004d50  20 68 61 6e 64 6c 65 72  20 69 6e 20 74 68 65 20  | handler in the |
00004d60  66 6f 6c 6c 6f 77 69 6e  67 20 77 61 79 3a 0a 0a  |following way:..|
00004d70  20 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |  SYS "MenuUtil_|
00004d80  44 65 63 6f 64 65 22 2c  2c 71 25 20 54 4f 20 68  |Decode",,q% TO h|
00004d90  61 6e 64 6c 65 72 25 20  20 20 20 20 20 20 20 20  |andler%         |
00004da0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004db0  20 20 20 0a 20 20 49 46  20 68 61 6e 64 6c 65 72  |   .  IF handler|
00004dc0  25 20 54 48 45 4e 0a 20  20 20 20 68 61 6e 64 6c  |% THEN.    handl|
00004dd0  65 72 24 3d 22 46 4e 22  2b 24 68 61 6e 64 6c 65  |er$="FN"+$handle|
00004de0  72 25 0a 20 20 20 20 49  46 20 45 56 41 4c 28 68  |r%.    IF EVAL(h|
00004df0  61 6e 64 6c 65 72 24 29  0a 20 20 45 4e 44 49 46  |andler$).  ENDIF|
00004e00  45 78 61 6d 70 6c 65 20  63 6f 64 65 20 28 4d 65  |Example code (Me|
00004e10  6e 75 55 74 69 6c 5f 53  68 6f 77 29 0a 53 75 70  |nuUtil_Show).Sup|
00004e20  70 6f 73 65 20 57 69 6d  70 5f 50 6f 6c 6c 20 68  |pose Wimp_Poll h|
00004e30  61 73 20 72 65 74 75 72  6e 65 64 20 72 65 61 73  |as returned reas|
00004e40  6f 6e 20 63 6f 64 65 20  36 20 28 4d 6f 75 73 65  |on code 6 (Mouse|
00004e50  5f 43 6c 69 63 6b 29 20  61 6e 64 20 71 25 20 70  |_Click) and q% p|
00004e60  6f 69 6e 74 73 20 74 6f  0a 74 68 65 20 72 65 74  |oints to.the ret|
00004e70  75 72 6e 65 64 20 62 6c  6f 63 6b 2e 20 44 69 73  |urned block. Dis|
00004e80  70 6c 61 79 20 6d 65 6e  75 20 6f 6e 20 73 63 72  |play menu on scr|
00004e90  65 65 6e 20 69 66 20 74  68 65 20 63 6c 69 63 6b  |een if the click|
00004ea0  20 69 73 20 77 69 74 68  20 4d 65 6e 75 20 62 75  | is with Menu bu|
00004eb0  74 74 6f 6e 2e 0a 0a 20  20 62 75 74 74 6f 6e 73  |tton...  buttons|
00004ec0  25 3d 71 25 21 38 0a 20  20 49 46 20 28 62 75 74  |%=q%!8.  IF (but|
00004ed0  74 6f 6e 73 25 20 41 4e  44 32 29 3c 3e 30 20 54  |tons% AND2)<>0 T|
00004ee0  48 45 4e 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |HEN SYS "MenuUti|
00004ef0  6c 5f 53 68 6f 77 22 2c  6d 61 69 6e 4d 65 6e 75  |l_Show",mainMenu|
00004f00  25 2c 71 25 0a 20 20 0a  4c 65 61 76 65 20 6d 65  |%,q%.  .Leave me|
00004f10  6e 75 20 6f 6e 20 73 63  72 65 65 6e 20 61 66 74  |nu on screen aft|
00004f20  65 72 20 73 65 6c 65 63  74 69 6f 6e 20 77 69 74  |er selection wit|
00004f30  68 20 41 64 6a 75 73 74  20 62 75 74 74 6f 6e 0a  |h Adjust button.|
00004f40  0a 20 20 53 59 53 20 22  4d 65 6e 75 55 74 69 6c  |.  SYS "MenuUtil|
00004f50  5f 53 68 6f 77 22 4d 65  6e 75 55 74 69 6c 5f 53  |_Show"MenuUtil_S|
00004f60  68 6f 77 20 28 53 57 49  20 26 34 35 42 43 35 29  |how (SWI &45BC5)|
00004f70  0a 44 69 73 70 6c 61 79  73 20 6d 65 6e 75 20 6f  |.Displays menu o|
00004f80  6e 20 73 63 72 65 65 6e  0a 0a 45 6e 74 72 79 3a  |n screen..Entry:|
00004f90  0a 20 20 20 20 52 30 20  3d 20 68 61 6e 64 6c 65  |.    R0 = handle|
00004fa0  20 6f 66 20 74 68 65 20  6d 65 6e 75 20 6f 72 20  | of the menu or |
00004fb0  7a 65 72 6f 20 66 6f 72  20 63 75 72 72 65 6e 74  |zero for current|
00004fc0  20 6d 65 6e 75 0a 20 20  20 20 52 31 20 2d 3e 20  | menu.    R1 -> |
00004fd0  70 6f 69 6e 74 65 72 20  74 6f 20 62 6c 6f 63 6b  |pointer to block|
00004fe0  20 6f 72 20 7a 65 72 6f  0a 45 78 69 74 3a 0a 20  | or zero.Exit:. |
00004ff0  20 20 20 52 30 2c 52 31  20 70 72 65 73 65 72 76  |   R0,R1 preserv|
00005000  65 64 0a 0a 54 68 69 73  20 63 61 6c 6c 20 6d 61  |ed..This call ma|
00005010  79 20 62 65 20 75 73 65  64 20 74 6f 20 64 69 73  |y be used to dis|
00005020  70 6c 61 79 20 6d 65 6e  75 20 6f 6e 20 73 63 72  |play menu on scr|
00005030  65 65 6e 2e 20 53 63 72  65 65 6e 20 70 6f 73 69  |een. Screen posi|
00005040  74 69 6f 6e 20 66 6f 72  20 6d 65 6e 75 0a 77 69  |tion for menu.wi|
00005050  6c 6c 20 62 65 20 63 61  6c 63 75 6c 61 74 65 64  |ll be calculated|
00005060  20 61 63 63 6f 72 64 69  6e 67 20 74 6f 20 72 75  | according to ru|
00005070  6c 65 73 20 64 65 73 63  72 69 62 65 64 20 69 6e  |les described in|
00005080  20 50 52 4d 2e 20 42 6c  6f 63 6b 20 70 6f 69 6e  | PRM. Block poin|
00005090  74 65 64 20 74 6f 20 62  79 0a 52 31 20 6d 75 73  |ted to by.R1 mus|
000050a0  74 20 63 6f 6e 74 61 69  6e 20 74 68 65 20 73 61  |t contain the sa|
000050b0  6d 65 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 61  |me information a|
000050c0  73 20 72 65 74 75 72 6e  65 64 20 62 79 20 57 69  |s returned by Wi|
000050d0  6d 70 5f 50 6f 6c 6c 20  69 6e 20 63 61 73 65 20  |mp_Poll in case |
000050e0  6f 66 0a 6d 6f 75 73 65  20 63 6c 69 63 6b 20 65  |of.mouse click e|
000050f0  76 65 6e 74 20 28 69 6e  20 66 61 63 74 20 6f 6e  |vent (in fact on|
00005100  6c 79 20 6d 6f 75 73 65  20 63 6f 6f 72 64 69 6e  |ly mouse coordin|
00005110  61 74 65 73 20 61 6e 64  20 77 69 6e 64 6f 77 20  |ates and window |
00005120  68 61 6e 64 6c 65 20 77  69 6c 6c 20 62 65 0a 75  |handle will be.u|
00005130  73 65 64 29 20 3a 0a 20  20 20 20 20 20 20 20 20  |sed) :.         |
00005140  20 20 20 20 20 20 20 20  20 20 20 20 52 31 20 2b  |            R1 +|
00005150  20 30 20 20 6d 6f 75 73  65 20 58 0a 20 20 20 20  | 0  mouse X.    |
00005160  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005170  20 52 31 20 2b 20 34 20  20 6d 6f 75 73 65 20 59  | R1 + 4  mouse Y|
00005180  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00005190  20 20 20 20 20 20 52 31  20 2b 20 38 20 20 62 75  |      R1 + 8  bu|
000051a0  74 74 6f 6e 73 0a 20 20  20 20 20 20 20 20 20 20  |ttons.          |
000051b0  20 20 20 20 20 20 20 20  20 20 20 52 31 20 2b 31  |           R1 +1|
000051c0  32 20 20 77 69 6e 64 6f  77 20 68 61 6e 64 6c 65  |2  window handle|
000051d0  20 28 2d 32 20 69 66 20  69 63 6f 6e 20 62 61 72  | (-2 if icon bar|
000051e0  29 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |).              |
000051f0  20 20 20 20 20 20 20 52  31 20 2b 31 36 20 20 69  |       R1 +16  i|
00005200  63 6f 6e 20 68 61 6e 64  6c 65 20 20 20 20 20 20  |con handle      |
00005210  20 20 20 20 20 20 20 20  20 20 0a 0a 4d 65 6e 75  |          ..Menu|
00005220  55 74 69 6c 73 20 61 75  74 6f 6d 61 74 69 63 61  |Utils automatica|
00005230  6c 6c 79 20 64 69 73 74  69 6e 67 75 69 73 68 65  |lly distinguishe|
00005240  73 20 69 63 6f 6e 62 61  72 20 6d 65 6e 75 73 20  |s iconbar menus |
00005250  66 72 6f 6d 20 6f 72 64  69 6e 61 72 79 0a 77 69  |from ordinary.wi|
00005260  6e 64 6f 77 20 6d 65 6e  75 73 2e 20 49 66 20 6d  |ndow menus. If m|
00005270  65 6e 75 20 69 73 20 61  6c 72 65 61 64 79 20 6f  |enu is already o|
00005280  6e 20 73 63 72 65 65 6e  20 61 6e 64 20 79 6f 75  |n screen and you|
00005290  20 77 61 6e 74 20 74 6f  20 72 65 6f 70 65 6e 20  | want to reopen |
000052a0  69 74 0a 61 66 74 65 72  20 75 73 65 72 20 73 65  |it.after user se|
000052b0  6c 65 63 74 69 6f 6e 20  77 69 74 68 20 41 64 6a  |lection with Adj|
000052c0  75 73 74 20 62 75 74 74  6f 6e 20 74 68 65 6e 20  |ust button then |
000052d0  70 6f 69 6e 74 65 72 20  74 6f 20 74 68 65 20 62  |pointer to the b|
000052e0  6c 6f 63 6b 20 6d 61 79  20 62 65 0a 6f 6d 69 74  |lock may be.omit|
000052f0  74 65 64 2e 0a 0a 45 78  61 6d 70 6c 65 20 63 6f  |ted...Example co|
00005300  64 65 2e 2e 2e 3d 3e 45  78 5f 53 68 6f 77 3e 4d  |de...=>Ex_Show>M|
00005310  65 6e 75 55 74 69 6c 5f  53 68 6f 77 53 75 62 4d  |enuUtil_ShowSubM|
00005320  65 6e 75 20 28 53 57 49  20 26 34 35 42 43 36 29  |enu (SWI &45BC6)|
00005330  0a 44 69 73 70 6c 61 79  20 73 75 62 6d 65 6e 75  |.Display submenu|
00005340  20 61 66 74 65 72 20 72  65 63 65 69 76 69 6e 67  | after receiving|
00005350  20 4d 65 73 73 61 67 65  5f 4d 65 6e 75 57 61 72  | Message_MenuWar|
00005360  6e 69 6e 67 0a 0a 45 6e  74 72 79 3a 0a 20 20 20  |ning..Entry:.   |
00005370  20 52 30 20 3d 20 68 61  6e 64 6c 65 20 6f 66 20  | R0 = handle of |
00005380  74 68 65 20 73 75 62 6d  65 6e 75 20 6f 72 20 7a  |the submenu or z|
00005390  65 72 6f 20 66 6f 72 20  63 75 72 72 65 6e 74 20  |ero for current |
000053a0  6d 65 6e 75 0a 20 20 20  20 52 31 20 2d 3e 20 70  |menu.    R1 -> p|
000053b0  6f 69 6e 74 65 72 20 74  6f 20 62 6c 6f 63 6b 0a  |ointer to block.|
000053c0  45 78 69 74 3a 0a 20 20  20 20 52 30 2c 52 31 20  |Exit:.    R0,R1 |
000053d0  70 72 65 73 65 72 76 65  64 0a 0a 54 68 69 73 20  |preserved..This |
000053e0  63 61 6c 6c 20 6d 61 79  20 62 65 20 75 73 65 64  |call may be used|
000053f0  20 74 6f 20 64 69 73 70  6c 61 79 20 73 75 62 6d  | to display subm|
00005400  65 6e 75 20 77 68 65 6e  20 61 20 6d 65 73 73 61  |enu when a messa|
00005410  67 65 20 74 79 70 65 20  4d 65 6e 75 57 61 72 6e  |ge type MenuWarn|
00005420  69 6e 67 0a 28 26 34 30  30 43 30 29 20 69 73 20  |ing.(&400C0) is |
00005430  72 65 63 65 69 76 65 64  20 62 79 20 61 6e 20 61  |received by an a|
00005440  70 70 6c 69 63 61 74 69  6f 6e 2e 20 54 68 69 73  |pplication. This|
00005450  20 6d 65 73 73 61 67 65  20 69 73 20 73 65 6e 74  | message is sent|
00005460  20 62 79 20 74 68 65 20  57 69 6d 70 0a 77 68 65  | by the Wimp.whe|
00005470  6e 20 73 75 62 6d 65 6e  75 20 69 73 20 61 62 6f  |n submenu is abo|
00005480  75 74 20 74 6f 20 62 65  20 61 63 63 65 73 73 65  |ut to be accesse|
00005490  64 20 62 79 20 74 68 65  20 70 6f 69 6e 74 65 72  |d by the pointer|
000054a0  20 6d 6f 76 69 6e 67 20  6f 76 65 72 20 74 68 65  | moving over the|
000054b0  0a 72 69 67 68 74 2d 70  6f 69 6e 74 69 6e 67 20  |.right-pointing |
000054c0  61 72 72 6f 77 20 6f 66  20 74 68 65 20 70 61 72  |arrow of the par|
000054d0  65 6e 74 20 6d 65 6e 75  2e 20 28 54 6f 20 66 69  |ent menu. (To fi|
000054e0  6e 64 20 6f 75 74 20 74  68 65 20 68 61 6e 64 6c  |nd out the handl|
000054f0  65 20 6f 66 20 74 68 65  0a 6d 65 6e 75 20 69 74  |e of the.menu it|
00005500  65 6d 20 69 6e 20 70 61  72 65 6e 74 20 6d 65 6e  |em in parent men|
00005510  75 20 79 6f 75 20 63 61  6e 20 75 73 65 20 3c 4d  |u you can use <M|
00005520  65 6e 75 55 74 69 6c 5f  44 65 63 6f 64 65 3e 29  |enuUtil_Decode>)|
00005530  2e 0a 0a 52 31 20 6f 6e  20 65 6e 74 72 79 20 6d  |...R1 on entry m|
00005540  75 73 74 20 70 6f 69 6e  74 20 74 6f 20 6d 65 73  |ust point to mes|
00005550  73 61 67 65 20 62 6c 6f  63 6b 20 28 69 6e 20 66  |sage block (in f|
00005560  61 63 74 20 6f 6e 6c 79  20 74 77 6f 20 77 6f 72  |act only two wor|
00005570  64 73 20 61 74 20 6f 66  66 73 65 74 73 0a 2b 32  |ds at offsets.+2|
00005580  34 20 61 6e 64 20 2b 32  38 20 77 69 6c 6c 20 62  |4 and +28 will b|
00005590  65 20 75 73 65 64 29 2e  0a 20 20 20 20 20 20 20  |e used)..       |
000055a0  20 20 20 20 20 20 20 20  20 20 0a 4e 6f 74 65 3a  |          .Note:|
000055b0  20 49 66 20 79 6f 75 20  70 6c 61 6e 20 74 6f 20  | If you plan to |
000055c0  75 73 65 20 3c 4d 65 6e  75 55 74 69 6c 5f 44 65  |use <MenuUtil_De|
000055d0  63 6f 64 65 3e 20 74 68  65 6e 20 61 6c 6c 20 73  |code> then all s|
000055e0  75 62 6d 65 6e 75 20 70  6f 69 6e 74 65 72 73 20  |ubmenu pointers |
000055f0  6d 75 73 74 20 62 65 0a  76 61 6c 69 64 2e 20 49  |must be.valid. I|
00005600  74 20 6d 65 61 6e 73 20  74 68 61 74 20 79 6f 75  |t means that you|
00005610  20 68 61 76 65 20 74 6f  20 6c 69 6e 6b 20 73 75  | have to link su|
00005620  62 6d 65 6e 75 20 70 6f  69 6e 74 65 64 20 74 6f  |bmenu pointed to|
00005630  20 62 79 20 52 30 20 77  69 74 68 0a 63 6f 72 72  | by R0 with.corr|
00005640  65 73 70 6f 6e 64 69 6e  67 20 6d 65 6e 75 20 69  |esponding menu i|
00005650  74 65 6d 2e 20 54 68 69  73 20 63 61 6e 20 62 65  |tem. This can be|
00005660  20 64 6f 6e 65 20 62 79  20 3c 4d 65 6e 75 55 74  | done by <MenuUt|
00005670  69 6c 5f 53 75 62 4d 65  6e 75 3e 2e 0a 0a 3c 45  |il_SubMenu>...<E|
00005680  78 61 6d 70 6c 65 20 63  6f 64 65 2e 2e 2e 3d 3e  |xample code...=>|
00005690  45 78 5f 53 68 6f 77 53  75 62 4d 65 6e 75 3e 45  |Ex_ShowSubMenu>E|
000056a0  78 61 6d 70 6c 65 20 63  6f 64 65 20 28 4d 65 6e  |xample code (Men|
000056b0  75 55 74 69 6c 5f 53 68  6f 77 53 75 62 4d 65 6e  |uUtil_ShowSubMen|
000056c0  75 29 0a 44 69 73 70 6c  61 79 20 66 6f 6e 74 73  |u).Display fonts|
000056d0  20 73 75 62 6d 65 6e 75  20 6f 6e 20 73 63 72 65  | submenu on scre|
000056e0  65 6e 20 61 66 74 65 72  20 72 65 63 65 69 76 69  |en after receivi|
000056f0  6e 67 20 4d 65 6e 75 57  61 72 6e 69 6e 67 3a 0a  |ng MenuWarning:.|
00005700  0a 20 20 53 59 53 20 22  4d 65 6e 75 55 74 69 6c  |.  SYS "MenuUtil|
00005710  5f 53 75 62 4d 65 6e 75  22 2c 66 6f 6e 74 73 49  |_SubMenu",fontsI|
00005720  74 65 6d 25 2c 66 6f 6e  74 73 4d 65 6e 75 25 0a  |tem%,fontsMenu%.|
00005730  20 20 53 59 53 20 22 4d  65 6e 75 55 74 69 6c 5f  |  SYS "MenuUtil_|
00005740  53 68 6f 77 53 75 62 4d  65 6e 75 22 2c 66 6f 6e  |ShowSubMenu",fon|
00005750  74 73 4d 65 6e 75 25 2c  71 25 4d 65 6e 75 55 74  |tsMenu%,q%MenuUt|
00005760  69 6c 5f 49 6e 66 6f 20  28 53 57 49 20 26 34 35  |il_Info (SWI &45|
00005770  42 43 37 29 0a 54 68 69  73 20 63 61 6c 6c 20 72  |BC7).This call r|
00005780  65 74 75 72 6e 73 20 76  61 72 69 6f 75 73 20 69  |eturns various i|
00005790  6e 66 6f 72 6d 61 74 69  6f 6e 20 61 62 6f 75 74  |nformation about|
000057a0  20 74 68 65 20 77 68 6f  6c 65 20 6d 65 6e 75 20  | the whole menu |
000057b0  6f 72 20 61 62 6f 75 74  20 74 68 65 0a 70 61 72  |or about the.par|
000057c0  74 69 63 75 6c 61 72 20  6d 65 6e 75 20 69 74 65  |ticular menu ite|
000057d0  6d 2e 0a 0a 45 6e 74 72  79 3a 0a 20 20 20 20 52  |m...Entry:.    R|
000057e0  30 20 3d 20 68 61 6e 64  6c 65 20 6f 66 20 74 68  |0 = handle of th|
000057f0  65 20 6d 65 6e 75 20 6f  72 20 6f 66 20 74 68 65  |e menu or of the|
00005800  20 6d 65 6e 75 20 69 74  65 6d 20 6f 72 20 7a 65  | menu item or ze|
00005810  72 6f 20 66 6f 72 20 63  75 72 72 65 6e 74 20 69  |ro for current i|
00005820  74 65 6d 0a 45 78 69 74  3a 0a 20 20 20 20 52 30  |tem.Exit:.    R0|
00005830  20 2d 3e 20 70 6f 69 6e  74 65 72 20 74 6f 20 62  | -> pointer to b|
00005840  6c 6f 63 6b 0a 0a 52 65  74 75 72 6e 65 64 20 62  |lock..Returned b|
00005850  6c 6f 63 6b 20 63 6f 6e  74 61 69 6e 73 20 74 68  |lock contains th|
00005860  65 20 66 6f 6c 6c 6f 77  69 6e 67 20 69 6e 66 6f  |e following info|
00005870  72 6d 61 74 69 6f 6e 3a  0a 20 20 20 52 30 20 2b  |rmation:.   R0 +|
00005880  20 30 20 70 6f 69 6e 74  65 72 20 74 6f 20 6d 65  | 0 pointer to me|
00005890  6e 75 20 64 61 74 61 20  73 74 72 75 63 74 75 72  |nu data structur|
000058a0  65 0a 20 20 20 52 30 20  2b 20 34 20 70 6f 69 6e  |e.   R0 + 4 poin|
000058b0  74 65 72 20 74 6f 20 69  74 65 6d 20 64 61 74 61  |ter to item data|
000058c0  20 6f 72 20 7a 65 72 6f  0a 0a 4d 65 6e 75 73 20  | or zero..Menus |
000058d0  63 72 65 61 74 65 64 20  77 69 74 68 20 4d 65 6e  |created with Men|
000058e0  75 55 74 69 6c 73 20 61  72 65 20 6e 6f 74 20 73  |uUtils are not s|
000058f0  74 61 74 69 63 20 61 6e  64 20 6d 61 79 20 62 65  |tatic and may be|
00005900  20 6d 6f 76 65 64 20 69  6e 0a 6d 65 6d 6f 72 79  | moved in.memory|
00005910  2c 20 66 6f 72 20 65 78  61 6d 70 6c 65 20 61 66  |, for example af|
00005920  74 65 72 20 61 64 64 69  6e 67 20 6e 65 77 20 69  |ter adding new i|
00005930  74 65 6d 73 2e 20 53 6f  20 79 6f 75 20 6d 75 73  |tems. So you mus|
00005940  74 20 75 73 65 20 64 69  72 65 63 74 0a 70 6f 69  |t use direct.poi|
00005950  6e 74 65 72 73 20 74 6f  20 74 68 69 73 20 6d 65  |nters to this me|
00005960  6e 75 73 20 77 69 74 68  20 63 61 75 74 69 6f 6e  |nus with caution|
00005970  20 75 6e 74 69 6c 20 79  6f 75 20 68 61 76 65 20  | until you have |
00005980  63 6f 6d 70 6c 65 74 65  6c 79 20 66 69 6e 69 73  |completely finis|
00005990  68 65 64 0a 74 68 65 20  6d 65 6e 75 20 63 6f 6e  |hed.the menu con|
000059a0  73 74 72 75 63 74 69 6f  6e 2e 4d 65 6e 75 55 74  |struction.MenuUt|
000059b0  69 6c 5f 54 65 78 74 20  28 53 57 49 20 26 34 35  |il_Text (SWI &45|
000059c0  42 43 38 29 0a 43 68 61  6e 67 65 73 20 6d 65 6e  |BC8).Changes men|
000059d0  75 20 74 69 74 6c 65 20  73 74 72 69 6e 67 20 6f  |u title string o|
000059e0  72 20 74 65 78 74 20 6f  66 20 6d 65 6e 75 20 69  |r text of menu i|
000059f0  74 65 6d 0a 0a 45 6e 74  72 79 3a 0a 20 20 20 20  |tem..Entry:.    |
00005a00  52 30 20 3d 20 68 61 6e  64 6c 65 20 6f 66 20 6d  |R0 = handle of m|
00005a10  65 6e 75 20 69 74 65 6d  20 6f 72 20 68 61 6e 64  |enu item or hand|
00005a20  6c 65 20 6f 66 20 6d 65  6e 75 20 6f 72 20 20 7a  |le of menu or  z|
00005a30  65 72 6f 20 66 6f 72 20  63 75 72 72 65 6e 74 20  |ero for current |
00005a40  69 74 65 6d 0a 20 20 20  20 52 31 20 2d 3e 20 70  |item.    R1 -> p|
00005a50  6f 69 6e 74 65 72 20 74  6f 20 74 65 78 74 20 73  |ointer to text s|
00005a60  74 72 69 6e 67 20 0a 45  78 69 74 3a 0a 20 20 20  |tring .Exit:.   |
00005a70  20 52 30 2c 52 31 20 70  72 65 73 65 72 76 65 64  | R0,R1 preserved|
00005a80  0a 20 0a 54 68 69 73 20  63 61 6c 6c 20 61 6c 6c  |. .This call all|
00005a90  6f 77 73 20 79 6f 75 20  74 6f 20 63 68 61 6e 67  |ows you to chang|
00005aa0  65 20 74 69 74 6c 65 20  73 74 72 69 6e 67 20 6f  |e title string o|
00005ab0  66 20 6d 65 6e 75 20 6f  72 20 74 65 78 74 20 6f  |f menu or text o|
00005ac0  66 20 6d 65 6e 75 20 69  74 65 6d 2e 0a 54 68 65  |f menu item..The|
00005ad0  20 73 74 72 75 63 74 75  72 65 20 6f 66 20 6d 65  | structure of me|
00005ae0  6e 75 20 74 72 65 65 20  72 65 6d 61 69 6e 73 20  |nu tree remains |
00005af0  75 6e 63 68 61 6e 67 65  64 20 62 75 74 20 70 6f  |unchanged but po|
00005b00  69 6e 74 65 72 20 74 6f  20 69 74 65 6d 20 74 65  |inter to item te|
00005b10  78 74 20 6d 61 79 20 62  65 0a 63 68 61 6e 67 65  |xt may be.change|
00005b20  64 2e 20 54 68 65 20 68  61 6e 64 6c 65 20 6f 66  |d. The handle of|
00005b30  20 74 68 65 20 6d 65 6e  75 20 6f 72 20 6d 65 6e  | the menu or men|
00005b40  75 20 69 74 65 6d 20 6d  75 73 74 20 62 65 20 73  |u item must be s|
00005b50  70 65 63 69 66 69 65 64  20 69 6e 20 52 30 2e 20  |pecified in R0. |
00005b60  49 66 20 52 30 0a 69 73  20 7a 65 72 6f 20 6f 6e  |If R0.is zero on|
00005b70  20 65 6e 74 72 79 20 74  68 65 6e 20 74 68 65 20  | entry then the |
00005b80  74 65 78 74 20 6f 66 20  63 75 72 72 65 6e 74 20  |text of current |
00005b90  69 74 65 6d 20 77 69 6c  6c 20 62 65 20 63 68 61  |item will be cha|
00005ba0  6e 67 65 64 2e 20 52 31  20 6d 75 73 74 0a 70 6f  |nged. R1 must.po|
00005bb0  69 6e 74 20 74 6f 20 74  68 65 20 63 74 72 6c 2d  |int to the ctrl-|
00005bc0  74 65 72 6d 69 6e 61 74  65 64 20 74 65 78 74 20  |terminated text |
00005bd0  73 74 72 69 6e 67 2e 20  49 66 20 52 31 20 69 73  |string. If R1 is|
00005be0  20 7a 65 72 6f 20 6f 6e  20 65 6e 74 72 79 20 74  | zero on entry t|
00005bf0  68 65 6e 20 6e 75 6c 6c  0a 73 74 72 69 6e 67 20  |hen null.string |
00005c00  77 69 6c 6c 20 62 65 20  75 73 65 64 2e 20 52 65  |will be used. Re|
00005c10  6d 65 6d 62 65 72 20 74  68 61 74 20 74 68 65 20  |member that the |
00005c20  6c 65 6e 67 74 68 20 6f  66 20 6d 65 6e 75 20 74  |length of menu t|
00005c30  69 74 6c 65 20 69 73 20  6c 69 6d 69 74 65 64 20  |itle is limited |
00005c40  62 79 20 31 32 0a 73 79  6d 62 6f 6c 73 2e 0a 0a  |by 12.symbols...|
00005c50  3c 45 78 61 6d 70 6c 65  20 63 6f 64 65 2e 2e 2e  |<Example code...|
00005c60  3d 3e 45 78 5f 54 65 78  74 3e 45 78 61 6d 70 6c  |=>Ex_Text>Exampl|
00005c70  65 20 63 6f 64 65 20 28  4d 65 6e 75 55 74 69 6c  |e code (MenuUtil|
00005c80  5f 54 65 78 74 29 0a 53  65 74 20 6e 65 77 20 6d  |_Text).Set new m|
00005c90  65 6e 75 20 74 69 74 6c  65 20 73 74 72 69 6e 67  |enu title string|
00005ca0  3a 0a 0a 20 20 53 59 53  20 22 4d 65 6e 75 55 74  |:..  SYS "MenuUt|
00005cb0  69 6c 5f 54 65 78 74 22  2c 6f 62 6a 65 63 74 4d  |il_Text",objectM|
00005cc0  65 6e 75 25 2c 22 44 69  72 65 63 74 6f 72 79 22  |enu%,"Directory"|
00005cd0  0a 0a 4c 65 74 27 73 20  76 61 72 69 61 62 6c 65  |..Let's variable|
00005ce0  20 74 79 70 65 25 20 63  6f 6e 74 61 69 6e 73 20  | type% contains |
00005cf0  6f 6e 65 20 6f 66 20 74  68 65 20 76 61 6c 75 65  |one of the value|
00005d00  73 20 30 2c 31 2c 32 20  6f 72 20 33 20 64 65 70  |s 0,1,2 or 3 dep|
00005d10  65 6e 64 69 6e 67 20 6f  6e 20 74 68 65 0a 6f 62  |ending on the.ob|
00005d20  6a 65 63 74 20 73 65 6c  65 63 74 65 64 20 69 6e  |ject selected in|
00005d30  20 46 69 6c 65 72 20 77  69 6e 64 6f 77 20 61 6e  | Filer window an|
00005d40  64 20 76 61 72 69 61 62  6c 65 20 6e 61 6d 65 24  |d variable name$|
00005d50  20 63 6f 6e 74 61 69 6e  73 20 74 68 65 20 6e 61  | contains the na|
00005d60  6d 65 20 6f 66 20 74 68  65 0a 66 69 6c 65 20 6f  |me of the.file o|
00005d70  72 20 64 69 72 65 63 74  6f 72 79 20 73 65 6c 65  |r directory sele|
00005d80  63 74 65 64 2e 20 20 0a  0a 20 20 43 41 53 45 20  |cted.  ..  CASE |
00005d90  74 79 70 65 25 20 4f 46  0a 20 20 20 20 57 48 45  |type% OF.    WHE|
00005da0  4e 20 30 3a 69 24 3d 22  46 69 6c 65 20 27 27 22  |N 0:i$="File ''"|
00005db0  0a 20 20 20 20 57 48 45  4e 20 31 3a 69 24 3d 22  |.    WHEN 1:i$="|
00005dc0  46 69 6c 65 20 27 22 2b  6e 61 6d 65 24 2b 22 27  |File '"+name$+"'|
00005dd0  22 3a 73 24 3d 22 46 69  6c 65 22 0a 20 20 20 20  |":s$="File".    |
00005de0  57 48 45 4e 20 32 3a 69  24 3d 22 44 69 72 2e 20  |WHEN 2:i$="Dir. |
00005df0  27 22 2b 6e 61 6d 65 24  2b 22 27 22 3a 73 24 3d  |'"+name$+"'":s$=|
00005e00  22 44 69 72 65 63 74 6f  72 79 22 0a 20 20 20 20  |"Directory".    |
00005e10  57 48 45 4e 20 33 3a 69  24 3d 22 53 65 6c 65 63  |WHEN 3:i$="Selec|
00005e20  74 69 6f 6e 22 3a 73 24  3d 69 24 0a 20 20 45 4e  |tion":s$=i$.  EN|
00005e30  44 43 41 53 45 0a 20 20  20 20 20 20 20 20 20 20  |DCASE.          |
00005e40  20 20 20 20 20 20 20 20  20 0a 52 45 4d 20 66 61  |         .REM fa|
00005e50  64 65 20 74 68 65 20 69  74 65 6d 20 69 66 20 6e  |de the item if n|
00005e60  6f 74 68 69 6e 67 20 69  73 20 73 65 6c 65 63 74  |othing is select|
00005e70  65 64 0a 0a 20 20 53 59  53 20 22 4d 65 6e 75 55  |ed..  SYS "MenuU|
00005e80  74 69 6c 5f 46 61 64 65  22 2c 6f 62 6a 65 63 74  |til_Fade",object|
00005e90  49 74 65 6d 25 2c 74 79  70 65 25 3d 30 20 20 20  |Item%,type%=0   |
00005ea0  20 20 20 20 20 20 20 20  0a 0a 52 45 4d 20 73 65  |        ..REM se|
00005eb0  74 20 6e 65 77 20 69 74  65 6d 20 74 65 78 74 0a  |t new item text.|
00005ec0  0a 20 20 53 59 53 20 22  4d 65 6e 75 55 74 69 6c  |.  SYS "MenuUtil|
00005ed0  5f 54 65 78 74 22 2c 2c  69 24 0a 20 20 20 20 20  |_Text",,i$.     |
00005ee0  20 20 20 20 20 20 0a 52  45 4d 20 73 65 74 20 6e  |      .REM set n|
00005ef0  65 77 20 73 75 62 6d 65  6e 75 20 74 69 74 6c 65  |ew submenu title|
00005f00  0a 0a 20 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |..  SYS "MenuUti|
00005f10  6c 5f 54 65 78 74 22 2c  74 6f 6f 6c 73 4d 65 6e  |l_Text",toolsMen|
00005f20  75 25 2c 73 24 45 78 61  6d 70 6c 65 20 63 6f 64  |u%,s$Example cod|
00005f30  65 20 28 4d 65 6e 75 55  74 69 6c 5f 54 69 63 6b  |e (MenuUtil_Tick|
00005f40  29 0a 54 69 63 6b 20 6f  6e 65 20 6f 66 20 74 68  |).Tick one of th|
00005f50  65 20 69 74 65 6d 73 20  64 65 70 65 6e 64 69 6e  |e items dependin|
00005f60  67 20 6f 6e 20 74 68 65  20 76 61 6c 75 65 20 6f  |g on the value o|
00005f70  66 20 76 61 72 69 61 62  6c 65 20 64 69 73 70 25  |f variable disp%|
00005f80  3a 0a 0a 20 20 53 59 53  20 22 4d 65 6e 75 55 74  |:..  SYS "MenuUt|
00005f90  69 6c 5f 54 69 63 6b 22  2c 6c 61 72 67 65 49 74  |il_Tick",largeIt|
00005fa0  65 6d 25 2c 28 64 69 73  70 25 3d 31 29 0a 20 20  |em%,(disp%=1).  |
00005fb0  53 59 53 20 22 4d 65 6e  75 55 74 69 6c 5f 54 69  |SYS "MenuUtil_Ti|
00005fc0  63 6b 22 2c 73 6d 61 6c  6c 49 74 65 6d 2c 28 64  |ck",smallItem,(d|
00005fd0  69 73 70 25 3d 32 29 0a  20 20 53 59 53 20 22 4d  |isp%=2).  SYS "M|
00005fe0  65 6e 75 55 74 69 6c 5f  54 69 63 6b 22 2c 66 75  |enuUtil_Tick",fu|
00005ff0  6c 6c 49 74 65 6d 25 2c  28 64 69 73 70 25 3d 33  |llItem%,(disp%=3|
00006000  29 4d 65 6e 75 55 74 69  6c 5f 54 69 63 6b 20 28  |)MenuUtil_Tick (|
00006010  53 57 49 20 26 34 35 42  43 39 29 0a 54 68 69 73  |SWI &45BC9).This|
00006020  20 63 61 6c 6c 20 6d 61  79 20 62 65 20 75 73 65  | call may be use|
00006030  64 20 74 6f 20 6d 6f 64  69 66 79 20 74 68 65 20  |d to modify the |
00006040  73 74 61 74 65 20 6f 66  20 6d 65 6e 75 20 66 6c  |state of menu fl|
00006050  61 67 20 77 68 69 63 68  20 63 6f 6e 74 72 6f 6c  |ag which control|
00006060  73 0a 74 68 65 20 74 69  63 6b 20 64 69 73 70 6c  |s.the tick displ|
00006070  61 79 65 64 20 6f 6e 20  74 68 65 20 6c 65 66 74  |ayed on the left|
00006080  20 6f 66 20 74 68 65 20  6d 65 6e 75 20 69 74 65  | of the menu ite|
00006090  6d 2e 20 0a 0a 45 6e 74  72 79 3a 0a 20 20 20 20  |m. ..Entry:.    |
000060a0  52 30 20 68 61 6e 64 6c  65 20 6f 66 20 6d 65 6e  |R0 handle of men|
000060b0  75 20 69 74 65 6d 20 6f  72 20 7a 65 72 6f 20 66  |u item or zero f|
000060c0  6f 72 20 63 75 72 72 65  6e 74 20 6d 65 6e 75 20  |or current menu |
000060d0  69 74 65 6d 20 6f 72 20  68 61 6e 64 6c 65 20 6f  |item or handle o|
000060e0  66 20 6d 65 6e 75 0a 20  20 20 20 52 31 20 64 65  |f menu.    R1 de|
000060f0  66 69 6e 65 73 20 61 63  74 69 6f 6e 0a 20 20 20  |fines action.   |
00006100  20 20 20 20 69 66 20 52  31 20 3d 30 20 74 68 65  |    if R1 =0 the|
00006110  6e 20 63 6c 65 61 72 20  74 69 63 6b 20 66 6c 61  |n clear tick fla|
00006120  67 20 0a 20 20 20 20 20  20 20 69 66 20 52 31 20  |g .       if R1 |
00006130  5c 3c 3e 30 20 74 68 65  6e 20 73 65 74 20 74 69  |\<>0 then set ti|
00006140  63 6b 20 66 6c 61 67 20  20 0a 45 78 69 74 3a 0a  |ck flag  .Exit:.|
00006150  20 20 20 52 30 2c 52 31  20 70 72 65 73 65 72 76  |   R0,R1 preserv|
00006160  65 64 0a 20 20 20 20 20  20 20 20 20 20 20 20 0a  |ed.            .|
00006170  52 30 20 6d 75 73 74 20  63 6f 6e 74 61 69 6e 20  |R0 must contain |
00006180  74 68 65 20 69 74 65 6d  20 68 61 6e 64 6c 65 20  |the item handle |
00006190  6f 72 20 7a 65 72 6f 20  66 6f 72 20 74 68 65 20  |or zero for the |
000061a0  63 75 72 72 65 6e 74 20  6d 65 6e 75 20 69 74 65  |current menu ite|
000061b0  6d 2e 20 52 31 0a 64 65  66 69 6e 65 73 20 74 6f  |m. R1.defines to|
000061c0  20 73 65 74 20 6f 72 20  74 6f 20 63 6c 65 61 72  | set or to clear|
000061d0  20 74 68 65 20 66 6c 61  67 2e 20 49 66 20 52 31  | the flag. If R1|
000061e0  20 69 73 20 7a 65 72 6f  20 74 68 65 6e 20 74 68  | is zero then th|
000061f0  65 20 66 6c 61 67 20 77  69 6c 6c 0a 62 65 20 63  |e flag will.be c|
00006200  6c 65 61 72 65 64 20 61  6e 64 20 69 66 20 52 31  |leared and if R1|
00006210  20 69 73 20 6e 6f 6e 20  7a 65 72 6f 20 74 68 65  | is non zero the|
00006220  6e 20 74 68 65 20 66 6c  61 67 20 77 69 6c 6c 20  |n the flag will |
00006230  62 65 20 73 65 74 2e 0a  0a 49 66 20 52 30 20 69  |be set...If R0 i|
00006240  6e 73 74 65 61 64 20 6f  66 20 69 74 65 6d 20 68  |nstead of item h|
00006250  61 6e 64 6c 65 20 63 6f  6e 74 61 69 6e 73 20 6d  |andle contains m|
00006260  65 6e 75 20 68 61 6e 64  6c 65 20 74 68 65 6e 20  |enu handle then |
00006270  74 68 65 20 73 74 61 74  65 20 6f 66 0a 74 68 65  |the state of.the|
00006280  20 66 6c 61 67 20 77 69  6c 6c 20 62 65 20 63 68  | flag will be ch|
00006290  61 6e 67 65 64 20 69 6e  20 61 6c 6c 20 69 74 65  |anged in all ite|
000062a0  6d 73 20 6f 66 20 74 68  69 73 20 6d 65 6e 75 2e  |ms of this menu.|
000062b0  0a 0a 49 74 20 69 73 20  63 6f 6e 76 65 6e 69 65  |..It is convenie|
000062c0  6e 74 20 74 6f 20 70 61  73 73 20 69 6e 20 52 31  |nt to pass in R1|
000062d0  20 74 68 65 20 72 65 73  75 6c 74 20 6f 66 20 6c  | the result of l|
000062e0  6f 67 69 63 61 6c 20 65  78 70 72 65 73 73 69 6f  |ogical expressio|
000062f0  6e 20 28 74 6f 0a 73 65  74 20 66 6c 61 67 20 69  |n (to.set flag i|
00006300  66 20 72 65 73 75 6c 74  20 69 73 20 54 52 55 45  |f result is TRUE|
00006310  20 61 6e 64 20 74 6f 20  63 6c 65 61 72 20 69 74  | and to clear it|
00006320  20 69 66 20 46 41 4c 53  45 29 2e 0a 0a 3c 45 78  | if FALSE)...<Ex|
00006330  61 6d 70 6c 65 20 63 6f  64 65 2e 2e 2e 3d 3e 45  |ample code...=>E|
00006340  78 5f 54 69 63 6b 3e 45  78 61 6d 70 6c 65 20 63  |x_Tick>Example c|
00006350  6f 64 65 20 28 4d 65 6e  75 55 74 69 6c 5f 44 6f  |ode (MenuUtil_Do|
00006360  74 73 29 0a 44 69 73 70  6c 61 79 20 64 6f 74 74  |ts).Display dott|
00006370  65 64 20 6c 69 6e 65 20  61 66 74 65 72 20 74 68  |ed line after th|
00006380  65 20 63 75 72 72 65 6e  74 20 6d 65 6e 75 20 69  |e current menu i|
00006390  74 65 6d 0a 0a 20 20 53  59 53 20 22 4d 65 6e 75  |tem..  SYS "Menu|
000063a0  55 74 69 6c 5f 44 6f 74  73 22 2c 2c 54 52 55 45  |Util_Dots",,TRUE|
000063b0  4d 65 6e 75 55 74 69 6c  5f 44 6f 74 73 20 28 53  |MenuUtil_Dots (S|
000063c0  57 49 20 20 26 34 35 42  43 41 29 0a 54 68 69 73  |WI  &45BCA).This|
000063d0  20 63 61 6c 6c 20 6d 61  79 20 62 65 20 75 73 65  | call may be use|
000063e0  64 20 74 6f 20 6d 6f 64  69 66 79 20 74 68 65 20  |d to modify the |
000063f0  73 74 61 74 65 20 6f 66  20 6d 65 6e 75 20 66 6c  |state of menu fl|
00006400  61 67 20 77 68 69 63 68  20 63 6f 6e 74 72 6f 6c  |ag which control|
00006410  73 0a 74 68 65 20 64 6f  74 74 65 64 20 6c 69 6e  |s.the dotted lin|
00006420  65 20 64 69 73 70 6c 61  79 65 64 20 62 65 6c 6f  |e displayed belo|
00006430  77 20 74 68 65 20 6d 65  6e 75 20 69 74 65 6d 2e  |w the menu item.|
00006440  20 0a 0a 45 6e 74 72 79  3a 0a 20 20 20 20 52 30  | ..Entry:.    R0|
00006450  20 68 61 6e 64 6c 65 20  6f 66 20 6d 65 6e 75 20  | handle of menu |
00006460  69 74 65 6d 20 6f 72 20  7a 65 72 6f 20 66 6f 72  |item or zero for|
00006470  20 63 75 72 72 65 6e 74  20 6d 65 6e 75 20 69 74  | current menu it|
00006480  65 6d 20 6f 72 20 68 61  6e 64 6c 65 20 6f 66 20  |em or handle of |
00006490  6d 65 6e 75 0a 20 20 20  20 52 31 20 64 65 66 69  |menu.    R1 defi|
000064a0  6e 65 73 20 61 63 74 69  6f 6e 0a 20 20 20 20 20  |nes action.     |
000064b0  20 20 69 66 20 52 31 20  3d 30 20 74 68 65 6e 20  |  if R1 =0 then |
000064c0  63 6c 65 61 72 20 64 6f  74 73 20 66 6c 61 67 20  |clear dots flag |
000064d0  0a 20 20 20 20 20 20 20  69 66 20 52 31 20 5c 3c  |.       if R1 \<|
000064e0  3e 30 20 74 68 65 6e 20  73 65 74 20 64 6f 74 73  |>0 then set dots|
000064f0  20 66 6c 61 67 20 20 0a  45 78 69 74 3a 0a 20 20  | flag  .Exit:.  |
00006500  20 52 30 2c 52 31 20 70  72 65 73 65 72 76 65 64  | R0,R1 preserved|
00006510  0a 20 20 20 20 20 20 20  20 20 20 20 20 0a 52 30  |.            .R0|
00006520  20 6d 75 73 74 20 63 6f  6e 74 61 69 6e 20 74 68  | must contain th|
00006530  65 20 69 74 65 6d 20 68  61 6e 64 6c 65 20 6f 72  |e item handle or|
00006540  20 7a 65 72 6f 20 66 6f  72 20 74 68 65 20 63 75  | zero for the cu|
00006550  72 72 65 6e 74 20 6d 65  6e 75 20 69 74 65 6d 2e  |rrent menu item.|
00006560  20 52 31 0a 64 65 66 69  6e 65 73 20 74 6f 20 73  | R1.defines to s|
00006570  65 74 20 6f 72 20 74 6f  20 63 6c 65 61 72 20 74  |et or to clear t|
00006580  68 65 20 66 6c 61 67 2e  20 49 66 20 52 31 20 69  |he flag. If R1 i|
00006590  73 20 7a 65 72 6f 20 74  68 65 6e 20 74 68 65 20  |s zero then the |
000065a0  66 6c 61 67 20 77 69 6c  6c 0a 62 65 20 63 6c 65  |flag will.be cle|
000065b0  61 72 65 64 20 61 6e 64  20 69 66 20 52 31 20 69  |ared and if R1 i|
000065c0  73 20 6e 6f 6e 20 7a 65  72 6f 20 74 68 65 6e 20  |s non zero then |
000065d0  74 68 65 20 66 6c 61 67  20 77 69 6c 6c 20 62 65  |the flag will be|
000065e0  20 73 65 74 2e 0a 0a 49  66 20 52 30 20 69 6e 73  | set...If R0 ins|
000065f0  74 65 61 64 20 6f 66 20  69 74 65 6d 20 68 61 6e  |tead of item han|
00006600  64 6c 65 20 63 6f 6e 74  61 69 6e 73 20 6d 65 6e  |dle contains men|
00006610  75 20 68 61 6e 64 6c 65  20 74 68 65 6e 20 74 68  |u handle then th|
00006620  65 20 73 74 61 74 65 20  6f 66 0a 74 68 65 20 66  |e state of.the f|
00006630  6c 61 67 20 77 69 6c 6c  20 62 65 20 63 68 61 6e  |lag will be chan|
00006640  67 65 64 20 69 6e 20 61  6c 6c 20 69 74 65 6d 73  |ged in all items|
00006650  20 6f 66 20 74 68 69 73  20 6d 65 6e 75 2e 0a 0a  | of this menu...|
00006660  49 74 20 69 73 20 63 6f  6e 76 65 6e 69 65 6e 74  |It is convenient|
00006670  20 74 6f 20 70 61 73 73  20 69 6e 20 52 31 20 74  | to pass in R1 t|
00006680  68 65 20 72 65 73 75 6c  74 20 6f 66 20 6c 6f 67  |he result of log|
00006690  69 63 61 6c 20 65 78 70  72 65 73 73 69 6f 6e 20  |ical expression |
000066a0  28 74 6f 0a 73 65 74 20  66 6c 61 67 20 69 66 20  |(to.set flag if |
000066b0  72 65 73 75 6c 74 20 69  73 20 54 52 55 45 20 61  |result is TRUE a|
000066c0  6e 64 20 74 6f 20 63 6c  65 61 72 20 69 74 20 69  |nd to clear it i|
000066d0  66 20 46 41 4c 53 45 29  2e 0a 0a 3c 45 78 61 6d  |f FALSE)...<Exam|
000066e0  70 6c 65 20 63 6f 64 65  2e 2e 2e 3d 3e 45 78 5f  |ple code...=>Ex_|
000066f0  44 6f 74 73 3e 45 78 61  6d 70 6c 65 20 63 6f 64  |Dots>Example cod|
00006700  65 20 28 4d 65 6e 75 55  74 69 6c 5f 46 61 64 65  |e (MenuUtil_Fade|
00006710  29 0a 46 61 64 65 20 63  75 72 72 65 6e 74 20 6d  |).Fade current m|
00006720  65 6e 75 20 69 74 65 6d  3a 0a 0a 20 20 53 59 53  |enu item:..  SYS|
00006730  20 22 4d 65 6e 75 55 74  69 6c 5f 46 61 64 65 22  | "MenuUtil_Fade"|
00006740  2c 2c 54 52 55 45 0a 0a  46 61 64 65 20 61 6c 6c  |,,TRUE..Fade all|
00006750  20 69 74 65 6d 73 20 69  6e 20 22 53 65 6c 65 63  | items in "Selec|
00006760  74 22 20 73 75 62 6d 65  6e 75 20 77 69 74 68 20  |t" submenu with |
00006770  68 61 6e 64 6c 65 20 73  65 6c 65 63 74 4d 65 6e  |handle selectMen|
00006780  75 25 0a 0a 20 20 53 59  53 20 22 4d 65 6e 75 55  |u%..  SYS "MenuU|
00006790  74 69 6c 5f 46 61 64 65  22 2c 73 65 6c 65 63 74  |til_Fade",select|
000067a0  4d 65 6e 75 25 2c 54 52  55 45 4d 65 6e 75 55 74  |Menu%,TRUEMenuUt|
000067b0  69 6c 5f 46 61 64 65 20  28 26 34 35 42 43 42 29  |il_Fade (&45BCB)|
000067c0  0a 54 68 69 73 20 63 61  6c 6c 20 63 61 6e 20 62  |.This call can b|
000067d0  65 20 75 73 65 64 20 74  6f 20 6d 61 6b 65 20 6d  |e used to make m|
000067e0  65 6e 75 20 69 74 65 6d  20 6e 6f 6e 2d 70 69 63  |enu item non-pic|
000067f0  6b 61 62 6c 65 20 0a 0a  45 6e 74 72 79 3a 0a 20  |kable ..Entry:. |
00006800  20 20 20 52 30 20 68 61  6e 64 6c 65 20 6f 66 20  |   R0 handle of |
00006810  6d 65 6e 75 20 69 74 65  6d 20 6f 72 20 7a 65 72  |menu item or zer|
00006820  6f 20 66 6f 72 20 63 75  72 72 65 6e 74 20 6d 65  |o for current me|
00006830  6e 75 20 69 74 65 6d 0a  20 20 20 20 20 20 20 6f  |nu item.       o|
00006840  72 20 68 61 6e 64 6c 65  20 6f 66 20 6d 65 6e 75  |r handle of menu|
00006850  0a 20 20 20 20 52 31 20  64 65 66 69 6e 65 73 20  |.    R1 defines |
00006860  61 63 74 69 6f 6e 0a 20  20 20 20 20 20 20 69 66  |action.       if|
00006870  20 52 31 20 3d 30 20 63  6c 65 61 72 20 73 68 61  | R1 =0 clear sha|
00006880  64 65 64 20 6d 65 6e 75  20 66 6c 61 67 0a 20 20  |ded menu flag.  |
00006890  20 20 20 20 20 69 66 20  52 31 20 5c 3c 3e 30 20  |     if R1 \<>0 |
000068a0  66 61 64 65 20 74 68 69  73 20 6d 65 6e 75 20 69  |fade this menu i|
000068b0  74 65 6d 20 28 69 65 2e  20 75 6e 70 69 63 6b 61  |tem (ie. unpicka|
000068c0  62 6c 65 29 20 0a 45 78  69 74 3a 0a 20 20 20 52  |ble) .Exit:.   R|
000068d0  30 2c 52 31 20 70 72 65  73 65 72 76 65 64 0a 20  |0,R1 preserved. |
000068e0  20 20 20 20 20 20 20 20  20 20 20 0a 52 30 20 6d  |           .R0 m|
000068f0  75 73 74 20 63 6f 6e 74  61 69 6e 20 74 68 65 20  |ust contain the |
00006900  69 74 65 6d 20 68 61 6e  64 6c 65 20 6f 72 20 7a  |item handle or z|
00006910  65 72 6f 20 66 6f 72 20  74 68 65 20 63 75 72 72  |ero for the curr|
00006920  65 6e 74 0a 6d 65 6e 75  20 69 74 65 6d 2e 20 52  |ent.menu item. R|
00006930  31 20 64 65 66 69 6e 65  73 20 74 6f 20 73 65 74  |1 defines to set|
00006940  20 6f 72 20 74 6f 20 63  6c 65 61 72 20 74 68 65  | or to clear the|
00006950  20 66 6c 61 67 20 77 68  69 63 68 0a 6d 61 6b 65  | flag which.make|
00006960  73 20 6d 65 6e 75 20 69  74 65 6d 20 75 6e 70 69  |s menu item unpi|
00006970  63 6b 61 62 6c 65 2e 20  49 66 20 52 31 20 69 73  |ckable. If R1 is|
00006980  20 7a 65 72 6f 20 74 68  65 6e 20 74 68 65 20 66  | zero then the f|
00006990  6c 61 67 0a 77 69 6c 6c  20 62 65 20 63 6c 65 61  |lag.will be clea|
000069a0  72 65 64 20 61 6e 64 20  69 66 20 52 31 20 69 73  |red and if R1 is|
000069b0  20 6e 6f 6e 20 7a 65 72  6f 20 74 68 65 6e 20 74  | non zero then t|
000069c0  68 65 20 66 6c 61 67 20  77 69 6c 6c 0a 62 65 20  |he flag will.be |
000069d0  73 65 74 20 61 6e 64 20  74 68 65 20 69 74 65 6d  |set and the item|
000069e0  20 77 69 6c 6c 20 62 65  20 73 68 61 64 65 64 2e  | will be shaded.|
000069f0  0a 0a 49 66 20 52 30 20  69 6e 73 74 65 61 64 20  |..If R0 instead |
00006a00  6f 66 20 69 74 65 6d 20  68 61 6e 64 6c 65 20 63  |of item handle c|
00006a10  6f 6e 74 61 69 6e 73 20  6d 65 6e 75 20 68 61 6e  |ontains menu han|
00006a20  64 6c 65 20 74 68 65 6e  0a 74 68 65 20 73 74 61  |dle then.the sta|
00006a30  74 65 20 6f 66 20 74 68  65 20 66 6c 61 67 20 77  |te of the flag w|
00006a40  69 6c 6c 20 62 65 20 63  68 61 6e 67 65 64 20 69  |ill be changed i|
00006a50  6e 20 61 6c 6c 20 69 74  65 6d 73 20 6f 66 0a 74  |n all items of.t|
00006a60  68 69 73 20 6d 65 6e 75  2e 0a 0a 49 74 20 69 73  |his menu...It is|
00006a70  20 63 6f 6e 76 65 6e 69  65 6e 74 20 74 6f 20 70  | convenient to p|
00006a80  61 73 73 20 69 6e 20 52  31 20 74 68 65 20 72 65  |ass in R1 the re|
00006a90  73 75 6c 74 20 6f 66 20  6c 6f 67 69 63 61 6c 0a  |sult of logical.|
00006aa0  65 78 70 72 65 73 73 69  6f 6e 20 28 74 6f 20 73  |expression (to s|
00006ab0  65 74 20 66 6c 61 67 20  69 66 20 72 65 73 75 6c  |et flag if resul|
00006ac0  74 20 69 73 20 54 52 55  45 20 61 6e 64 20 74 6f  |t is TRUE and to|
00006ad0  20 63 6c 65 61 72 0a 69  74 20 69 66 20 46 41 4c  | clear.it if FAL|
00006ae0  53 45 29 2e 0a 0a 3c 45  78 61 6d 70 6c 65 20 63  |SE)...<Example c|
00006af0  6f 64 65 2e 2e 2e 3d 3e  45 78 5f 46 61 64 65 3e  |ode...=>Ex_Fade>|
00006b00  45 78 61 6d 70 6c 65 20  63 6f 64 65 20 28 4d 65  |Example code (Me|
00006b10  6e 75 55 74 69 6c 5f 57  61 72 6e 69 6e 67 29 0a  |nuUtil_Warning).|
00006b20  47 65 6e 65 72 61 74 65  20 6d 65 73 73 61 67 65  |Generate message|
00006b30  20 77 68 65 6e 20 6d 6f  76 69 6e 67 20 74 6f 20  | when moving to |
00006b40  74 68 65 20 66 6f 6e 74  73 20 73 75 62 6d 65 6e  |the fonts submen|
00006b50  75 3a 0a 0a 20 20 53 59  53 20 22 4d 65 6e 75 55  |u:..  SYS "MenuU|
00006b60  74 69 6c 5f 57 61 72 6e  69 6e 67 22 2c 66 6f 6e  |til_Warning",fon|
00006b70  74 73 49 74 65 6d 25 2c  54 52 55 45 4d 65 6e 75  |tsItem%,TRUEMenu|
00006b80  55 74 69 6c 5f 57 61 72  6e 69 6e 67 20 28 53 57  |Util_Warning (SW|
00006b90  49 20 26 34 35 42 43 43  29 0a 54 68 69 73 20 63  |I &45BCC).This c|
00006ba0  61 6c 6c 20 63 61 6e 20  62 65 20 75 73 65 64 20  |all can be used |
00006bb0  74 6f 20 6d 61 6b 65 20  6d 65 6e 75 20 69 74 65  |to make menu ite|
00006bc0  6d 20 67 65 6e 65 72 61  74 65 20 61 20 6d 65 73  |m generate a mes|
00006bd0  73 61 67 65 20 77 68 65  6e 20 6d 6f 76 69 6e 67  |sage when moving|
00006be0  20 74 6f 0a 74 68 65 20  73 75 62 6d 65 6e 75 20  | to.the submenu |
00006bf0  0a 0a 45 6e 74 72 79 3a  0a 20 20 20 20 52 30 20  |..Entry:.    R0 |
00006c00  68 61 6e 64 6c 65 20 6f  66 20 6d 65 6e 75 20 69  |handle of menu i|
00006c10  74 65 6d 20 6f 72 20 7a  65 72 6f 20 66 6f 72 20  |tem or zero for |
00006c20  63 75 72 72 65 6e 74 20  6d 65 6e 75 20 69 74 65  |current menu ite|
00006c30  6d 20 6f 72 20 68 61 6e  64 6c 65 20 6f 66 20 6d  |m or handle of m|
00006c40  65 6e 75 0a 20 20 20 20  52 31 20 64 65 66 69 6e  |enu.    R1 defin|
00006c50  65 73 20 61 63 74 69 6f  6e 0a 20 20 20 20 20 20  |es action.      |
00006c60  20 69 66 20 52 31 20 3d  30 20 63 6c 65 61 72 20  | if R1 =0 clear |
00006c70  6d 65 73 73 61 67 65 20  6d 65 6e 75 20 66 6c 61  |message menu fla|
00006c80  67 0a 20 20 20 20 20 20  20 69 66 20 52 31 20 3c  |g.       if R1 <|
00006c90  3e 30 20 73 65 74 20 6d  65 73 73 61 67 65 20 66  |>0 set message f|
00006ca0  6c 61 67 20 28 69 65 2e  20 6d 65 73 73 61 67 65  |lag (ie. message|
00006cb0  20 77 69 6c 6c 20 62 65  20 67 65 6e 65 72 61 74  | will be generat|
00006cc0  65 64 29 20 0a 45 78 69  74 3a 0a 20 20 20 52 30  |ed) .Exit:.   R0|
00006cd0  2c 52 31 20 70 72 65 73  65 72 76 65 64 0a 20 20  |,R1 preserved.  |
00006ce0  20 20 20 20 20 20 20 20  20 20 0a 52 30 20 6d 75  |          .R0 mu|
00006cf0  73 74 20 63 6f 6e 74 61  69 6e 20 74 68 65 20 69  |st contain the i|
00006d00  74 65 6d 20 68 61 6e 64  6c 65 20 6f 72 20 7a 65  |tem handle or ze|
00006d10  72 6f 20 66 6f 72 20 74  68 65 20 63 75 72 72 65  |ro for the curre|
00006d20  6e 74 20 6d 65 6e 75 20  69 74 65 6d 2e 20 52 31  |nt menu item. R1|
00006d30  0a 64 65 66 69 6e 65 73  20 74 6f 20 73 65 74 20  |.defines to set |
00006d40  6f 72 20 74 6f 20 63 6c  65 61 72 20 74 68 65 20  |or to clear the |
00006d50  66 6c 61 67 20 77 68 69  63 68 20 63 68 61 6e 67  |flag which chang|
00006d60  65 73 20 73 75 62 6d 65  6e 75 20 62 65 68 61 76  |es submenu behav|
00006d70  69 6f 75 72 2e 20 49 66  20 52 31 0a 69 73 20 6e  |iour. If R1.is n|
00006d80  6f 74 20 7a 65 72 6f 2c  20 74 68 65 6e 20 6d 6f  |ot zero, then mo|
00006d90  76 69 6e 67 20 6f 76 65  72 20 74 68 65 20 72 69  |ving over the ri|
00006da0  67 68 74 20 61 72 72 6f  77 20 77 69 6c 6c 20 63  |ght arrow will c|
00006db0  61 75 73 65 20 61 20 4d  65 6e 75 57 61 72 6e 69  |ause a MenuWarni|
00006dc0  6e 67 0a 6d 65 73 73 61  67 65 20 28 26 34 30 30  |ng.message (&400|
00006dd0  43 30 29 20 74 6f 20 62  65 20 67 65 6e 65 72 61  |C0) to be genera|
00006de0  74 65 64 2e 20 54 68 65  20 61 70 70 6c 69 63 61  |ted. The applica|
00006df0  74 69 6f 6e 20 63 61 6e  20 72 65 73 70 6f 6e 64  |tion can respond|
00006e00  20 62 79 20 63 61 6c 6c  69 6e 67 0a 3c 4d 65 6e  | by calling.<Men|
00006e10  75 55 74 69 6c 5f 53 68  6f 77 53 75 62 4d 65 6e  |uUtil_ShowSubMen|
00006e20  75 3e 20 74 6f 20 64 69  73 70 6c 61 79 20 61 70  |u> to display ap|
00006e30  70 72 6f 70 72 69 61 74  65 20 6f 62 6a 65 63 74  |propriate object|
00006e40  2e 0a 0a 49 66 20 52 30  20 69 6e 73 74 65 61 64  |...If R0 instead|
00006e50  20 6f 66 20 69 74 65 6d  20 68 61 6e 64 6c 65 20  | of item handle |
00006e60  63 6f 6e 74 61 69 6e 73  20 6d 65 6e 75 20 68 61  |contains menu ha|
00006e70  6e 64 6c 65 20 74 68 65  6e 20 74 68 65 20 73 74  |ndle then the st|
00006e80  61 74 65 20 6f 66 0a 74  68 65 20 66 6c 61 67 20  |ate of.the flag |
00006e90  77 69 6c 6c 20 62 65 20  63 68 61 6e 67 65 64 20  |will be changed |
00006ea0  69 6e 20 61 6c 6c 20 69  74 65 6d 73 20 6f 66 20  |in all items of |
00006eb0  74 68 69 73 20 6d 65 6e  75 2e 0a 0a 49 74 20 69  |this menu...It i|
00006ec0  73 20 63 6f 6e 76 65 6e  69 65 6e 74 20 74 6f 20  |s convenient to |
00006ed0  70 61 73 73 20 69 6e 20  52 31 20 74 68 65 20 72  |pass in R1 the r|
00006ee0  65 73 75 6c 74 20 6f 66  20 6c 6f 67 69 63 61 6c  |esult of logical|
00006ef0  20 65 78 70 72 65 73 73  69 6f 6e 20 28 74 6f 0a  | expression (to.|
00006f00  73 65 74 20 66 6c 61 67  20 69 66 20 72 65 73 75  |set flag if resu|
00006f10  6c 74 20 69 73 20 54 52  55 45 20 61 6e 64 20 74  |lt is TRUE and t|
00006f20  6f 20 63 6c 65 61 72 20  69 74 20 69 66 20 46 41  |o clear it if FA|
00006f30  4c 53 45 29 2e 0a 0a 3c  45 78 61 6d 70 6c 65 20  |LSE)...<Example |
00006f40  63 6f 64 65 2e 2e 2e 3d  3e 45 78 5f 57 61 72 6e  |code...=>Ex_Warn|
00006f50  69 6e 67 3e 45 78 61 6d  70 6c 65 20 63 6f 64 65  |ing>Example code|
00006f60  20 28 4d 65 6e 75 55 74  69 6c 5f 57 72 69 74 61  | (MenuUtil_Writa|
00006f70  62 6c 65 29 0a 4d 61 6b  65 20 63 75 72 72 65 6e  |ble).Make curren|
00006f80  74 20 69 74 65 6d 20 77  72 69 74 61 62 6c 65 20  |t item writable |
00006f90  77 69 74 68 6f 75 74 20  76 61 6c 69 64 61 74 69  |without validati|
00006fa0  6f 6e 20 73 74 72 69 6e  67 3a 0a 0a 20 20 53 59  |on string:..  SY|
00006fb0  53 20 22 4d 65 6e 75 55  74 69 6c 5f 57 72 69 74  |S "MenuUtil_Writ|
00006fc0  61 62 6c 65 22 2c 2c 54  52 55 45 0a 0a 4d 61 6b  |able",,TRUE..Mak|
00006fd0  65 20 6d 65 6e 75 20 69  74 65 6d 20 77 69 74 68  |e menu item with|
00006fe0  20 68 61 6e 64 6c 65 20  77 69 64 74 68 49 74 65  | handle widthIte|
00006ff0  6d 25 20 77 72 69 74 61  62 6c 65 2c 20 77 69 74  |m% writable, wit|
00007000  68 20 62 75 66 66 65 72  20 73 69 7a 65 20 34 30  |h buffer size 40|
00007010  20 61 6e 64 0a 61 6c 6c  6f 77 20 74 6f 20 65 6e  | and.allow to en|
00007020  74 65 72 20 74 6f 20 69  74 20 6f 6e 6c 79 20 64  |ter to it only d|
00007030  69 67 69 74 73 3a 0a 0a  20 20 53 59 53 20 22 4d  |igits:..  SYS "M|
00007040  65 6e 75 55 74 69 6c 5f  57 72 69 74 61 62 6c 65  |enuUtil_Writable|
00007050  22 2c 77 69 64 74 68 49  74 65 6d 25 2c 54 52 55  |",widthItem%,TRU|
00007060  45 2c 34 30 2c 22 41 30  2d 39 22 4d 65 6e 75 55  |E,40,"A0-9"MenuU|
00007070  74 69 6c 5f 57 72 69 74  61 62 6c 65 20 28 53 57  |til_Writable (SW|
00007080  49 20 26 34 35 42 43 44  29 0a 4d 61 6b 65 73 20  |I &45BCD).Makes |
00007090  6d 65 6e 75 20 69 74 65  6d 20 77 72 69 74 61 62  |menu item writab|
000070a0  6c 65 2e 0a 0a 45 6e 74  72 79 3a 0a 20 20 20 20  |le...Entry:.    |
000070b0  52 30 20 3d 20 68 61 6e  64 6c 65 20 6f 66 20 6d  |R0 = handle of m|
000070c0  65 6e 75 20 69 74 65 6d  20 6f 72 20 7a 65 72 6f  |enu item or zero|
000070d0  20 66 6f 72 20 63 75 72  72 65 6e 74 20 69 74 65  | for current ite|
000070e0  6d 20 6f 72 20 68 61 6e  64 6c 65 20 6f 66 20 74  |m or handle of t|
000070f0  68 65 20 6d 65 6e 75 0a  20 20 20 20 52 31 20 5c  |he menu.    R1 \|
00007100  3c 3e 30 20 61 6e 64 0a  20 20 20 20 52 32 20 3d  |<>0 and.    R2 =|
00007110  20 62 75 66 66 65 72 20  73 69 7a 65 0a 20 20 20  | buffer size.   |
00007120  20 52 33 20 2d 3e 20 70  6f 69 6e 74 65 72 20 74  | R3 -> pointer t|
00007130  6f 20 76 61 6c 69 64 61  74 69 6f 6e 20 73 74 72  |o validation str|
00007140  69 6e 67 2c 20 6f 72 0a  0a 20 20 20 20 52 31 20  |ing, or..    R1 |
00007150  3d 30 20 6d 61 6b 65 73  20 69 74 65 6d 20 6e 6f  |=0 makes item no|
00007160  74 20 77 72 69 74 61 62  6c 65 0a 45 78 69 74 3a  |t writable.Exit:|
00007170  0a 20 20 20 20 52 30 2d  52 33 20 70 72 65 73 65  |.    R0-R3 prese|
00007180  72 76 65 64 0a 0a 49 66  20 52 31 20 69 73 20 6e  |rved..If R1 is n|
00007190  6f 74 20 7a 65 72 6f 20  6f 6e 20 65 6e 74 72 79  |ot zero on entry|
000071a0  20 74 68 65 6e 20 74 68  69 73 20 63 61 6c 6c 20  | then this call |
000071b0  77 69 6c 6c 20 63 6f 6e  76 65 72 74 20 65 78 69  |will convert exi|
000071c0  73 74 69 6e 67 20 6d 65  6e 75 20 69 74 65 6d 0a  |sting menu item.|
000071d0  69 6e 74 6f 20 77 72 69  74 61 62 6c 65 20 69 74  |into writable it|
000071e0  65 6d 2e 20 52 30 20 6d  75 73 74 20 63 6f 6e 74  |em. R0 must cont|
000071f0  61 69 6e 20 74 68 65 20  68 61 6e 64 6c 65 20 6f  |ain the handle o|
00007200  66 20 74 68 65 20 6d 65  6e 75 20 69 74 65 6d 20  |f the menu item |
00007210  6f 72 20 7a 65 72 6f 20  66 6f 72 0a 63 75 72 72  |or zero for.curr|
00007220  65 6e 74 20 69 74 65 6d  2e 20 49 66 20 52 30 20  |ent item. If R0 |
00007230  63 6f 6e 74 61 69 6e 73  20 68 61 6e 64 6c 65 20  |contains handle |
00007240  6f 66 20 74 68 65 20 6d  65 6e 75 20 74 68 65 6e  |of the menu then|
00007250  20 61 6c 6c 20 74 68 65  20 69 74 65 6d 73 20 69  | all the items i|
00007260  6e 20 74 68 69 73 0a 6d  65 6e 75 20 77 69 6c 6c  |n this.menu will|
00007270  20 62 65 20 63 6f 6e 76  65 72 74 65 64 2e 20 0a  | be converted. .|
00007280  0a 52 32 20 6f 6e 20 65  6e 74 72 79 20 63 6f 6e  |.R2 on entry con|
00007290  74 61 69 6e 73 20 74 68  65 20 6c 65 6e 67 74 68  |tains the length|
000072a0  20 6f 66 20 74 68 65 20  62 75 66 66 65 72 20 66  | of the buffer f|
000072b0  6f 72 20 74 68 65 20 69  6e 70 75 74 20 73 74 72  |or the input str|
000072c0  69 6e 67 2e 0a 54 68 65  20 76 61 6c 75 65 20 69  |ing..The value i|
000072d0  6e 20 52 32 20 6d 75 73  74 20 62 65 20 6e 6f 74  |n R2 must be not|
000072e0  20 6c 65 73 73 20 74 68  65 6e 20 74 68 65 20 6c  | less then the l|
000072f0  65 6e 67 74 68 20 6f 66  20 74 68 65 20 63 75 72  |ength of the cur|
00007300  72 65 6e 74 20 69 74 65  6d 0a 74 65 78 74 2e 20  |rent item.text. |
00007310  49 6e 20 74 68 65 20 6c  61 74 74 65 72 20 63 61  |In the latter ca|
00007320  73 65 20 74 68 65 20 62  75 66 66 65 72 20 77 69  |se the buffer wi|
00007330  6c 6c 20 72 65 6d 61 69  6e 20 75 6e 63 68 61 6e  |ll remain unchan|
00007340  67 65 64 2e 0a 0a 49 66  20 52 33 3c 3e 30 20 6f  |ged...If R3<>0 o|
00007350  6e 20 65 6e 74 72 79 20  74 68 65 6e 20 69 74 20  |n entry then it |
00007360  70 6f 69 6e 74 73 20 74  6f 20 74 68 65 20 63 74  |points to the ct|
00007370  72 6c 2d 74 65 72 6d 69  6e 61 74 65 64 20 76 61  |rl-terminated va|
00007380  6c 69 64 61 74 69 6f 6e  0a 73 74 72 69 6e 67 2e  |lidation.string.|
00007390  20 54 68 65 20 6d 6f 64  75 6c 65 20 6d 61 6b 65  | The module make|
000073a0  73 20 69 74 73 20 6f 77  6e 20 63 6f 70 79 20 6f  |s its own copy o|
000073b0  66 20 74 68 65 20 73 74  72 69 6e 67 2e 20 49 66  |f the string. If|
000073c0  20 52 33 3d 30 20 6f 6e  20 65 6e 74 72 79 0a 74  | R3=0 on entry.t|
000073d0  68 65 6e 20 6e 6f 20 76  61 6c 69 64 61 74 69 6f  |hen no validatio|
000073e0  6e 20 73 74 72 69 6e 67  20 77 69 6c 6c 20 62 65  |n string will be|
000073f0  20 75 73 65 64 2e 0a 0a  49 66 20 52 31 20 69 73  | used...If R1 is|
00007400  20 7a 65 72 6f 20 6f 6e  20 65 6e 74 72 79 20 74  | zero on entry t|
00007410  68 65 6e 20 74 68 65 20  69 74 65 6d 20 77 69 6c  |hen the item wil|
00007420  6c 20 62 65 20 63 6f 6e  76 65 72 74 65 64 20 62  |l be converted b|
00007430  61 63 6b 20 69 6e 74 6f  20 6f 72 64 69 6e 61 72  |ack into ordinar|
00007440  79 0a 6d 65 6e 75 20 69  74 65 6d 2e 20 49 6e 20  |y.menu item. In |
00007450  74 68 69 73 20 63 61 73  65 20 63 6f 6e 74 65 6e  |this case conten|
00007460  74 73 20 6f 66 20 72 65  67 69 73 74 65 72 73 20  |ts of registers |
00007470  52 32 20 61 6e 64 20 52  33 20 77 69 6c 6c 20 62  |R2 and R3 will b|
00007480  65 20 69 67 6e 6f 72 65  64 2e 0a 0a 3c 45 78 61  |e ignored...<Exa|
00007490  6d 70 6c 65 20 63 6f 64  65 2e 2e 2e 3d 3e 45 78  |mple code...=>Ex|
000074a0  5f 57 72 69 74 61 62 6c  65 3e 45 78 61 6d 70 6c  |_Writable>Exampl|
000074b0  65 20 63 6f 64 65 20 28  4d 65 6e 75 55 74 69 6c  |e code (MenuUtil|
000074c0  5f 53 75 62 6d 65 6e 75  29 0a 43 6f 6e 6e 65 63  |_Submenu).Connec|
000074d0  74 20 22 41 62 6f 75 74  20 74 68 69 73 20 70 72  |t "About this pr|
000074e0  6f 67 72 61 6d 22 20 77  69 6e 64 6f 77 20 74 6f  |ogram" window to|
000074f0  20 74 68 65 20 69 74 65  6d 20 22 49 6e 66 6f 22  | the item "Info"|
00007500  3a 0a 20 0a 20 20 53 59  53 20 22 57 69 6d 70 5f  |:. .  SYS "Wimp_|
00007510  43 72 65 61 74 65 57 69  6e 64 6f 77 22 2c 2c 62  |CreateWindow",,b|
00007520  6c 6f 63 6b 25 20 54 4f  20 69 6e 66 6f 57 69 6e  |lock% TO infoWin|
00007530  64 6f 77 25 0a 20 20 53  59 53 20 22 4d 65 6e 75  |dow%.  SYS "Menu|
00007540  55 74 69 6c 5f 53 75 62  6d 65 6e 75 22 2c 69 6e  |Util_Submenu",in|
00007550  66 6f 49 74 65 6d 25 2c  69 6e 66 6f 57 69 6e 64  |foItem%,infoWind|
00007560  6f 77 25 0a 0a 43 72 65  61 74 65 20 22 44 69 73  |ow%..Create "Dis|
00007570  70 6c 61 79 22 20 69 74  65 6d 20 69 6e 20 66 69  |play" item in fi|
00007580  6c 65 72 20 6d 65 6e 75  3a 0a 0a 20 20 53 59 53  |ler menu:..  SYS|
00007590  20 22 4d 65 6e 75 55 74  69 6c 5f 4e 65 77 22 2c  | "MenuUtil_New",|
000075a0  2c 22 46 69 6c 65 72 22  0a 20 20 53 59 53 20 22  |,"Filer".  SYS "|
000075b0  4d 65 6e 75 55 74 69 6c  5f 41 64 64 22 2c 2c 22  |MenuUtil_Add",,"|
000075c0  44 69 73 70 6c 61 79 22  0a 20 20 53 59 53 20 22  |Display".  SYS "|
000075d0  4d 65 6e 75 55 74 69 6c  5f 53 75 62 6d 65 6e 75  |MenuUtil_Submenu|
000075e0  22 2c 2c 64 69 73 70 4d  65 6e 75 25 20 4d 65 6e  |",,dispMenu% Men|
000075f0  75 55 74 69 6c 5f 53 75  62 6d 65 6e 75 20 28 53  |uUtil_Submenu (S|
00007600  57 49 20 26 34 35 42 43  45 29 0a 4c 69 6e 6b 73  |WI &45BCE).Links|
00007610  20 73 75 62 6d 65 6e 75  20 74 6f 20 6d 65 6e 75  | submenu to menu|
00007620  20 69 74 65 6d 0a 0a 45  6e 74 72 79 3a 0a 20 20  | item..Entry:.  |
00007630  20 20 52 30 20 68 61 6e  64 6c 65 20 6f 66 20 74  |  R0 handle of t|
00007640  68 65 20 6d 65 6e 75 20  69 74 65 6d 20 6f 72 20  |he menu item or |
00007650  7a 65 72 6f 20 69 66 20  63 75 72 72 65 6e 74 20  |zero if current |
00007660  6d 65 6e 75 20 69 74 65  6d 0a 20 20 20 20 52 31  |menu item.    R1|
00007670  20 68 61 6e 64 6c 65 20  6f 66 20 73 75 62 6d 65  | handle of subme|
00007680  6e 75 20 6f 72 20 70 6f  69 6e 74 65 72 20 74 6f  |nu or pointer to|
00007690  20 73 75 62 6d 65 6e 75  20 6f 72 20 77 69 6e 64  | submenu or wind|
000076a0  6f 77 20 68 61 6e 64 6c  65 0a 20 20 20 20 20 20  |ow handle.      |
000076b0  20 69 66 20 52 31 5c 3c  26 38 30 30 30 20 74 68  | if R1\<&8000 th|
000076c0  65 6e 20 52 31 20 69 73  20 77 69 6e 64 6f 77 20  |en R1 is window |
000076d0  68 61 6e 64 6c 65 0a 20  20 20 20 20 20 20 69 66  |handle.       if|
000076e0  20 52 31 3e 26 38 30 30  30 20 74 68 65 6e 20 52  | R1>&8000 then R|
000076f0  31 20 69 73 20 70 6f 69  6e 74 65 72 20 74 6f 20  |1 is pointer to |
00007700  6d 65 6e 75 20 0a 20 20  20 20 20 20 20 69 66 20  |menu .       if |
00007710  52 31 5c 3c 30 20 74 68  65 6e 20 52 31 20 69 73  |R1\<0 then R1 is|
00007720  20 6d 65 6e 75 20 68 61  6e 64 6c 65 0a 0a 45 78  | menu handle..Ex|
00007730  69 74 3a 0a 20 20 20 20  52 30 2c 52 31 20 70 72  |it:.    R0,R1 pr|
00007740  65 73 65 72 76 65 64 0a  0a 54 68 69 73 20 63 61  |eserved..This ca|
00007750  6c 6c 20 69 73 20 75 73  65 64 20 66 6f 72 20 63  |ll is used for c|
00007760  6f 6e 73 74 72 75 63 74  69 6e 67 20 6d 75 6c 74  |onstructing mult|
00007770  69 6c 65 76 65 6c 20 6d  65 6e 75 73 2e 20 52 30  |ilevel menus. R0|
00007780  20 6f 6e 20 65 6e 74 72  79 0a 63 6f 6e 74 61 69  | on entry.contai|
00007790  6e 73 20 74 68 65 20 68  61 6e 64 6c 65 20 6f 66  |ns the handle of|
000077a0  20 6d 65 6e 75 20 69 74  65 6d 2e 20 54 68 69 73  | menu item. This|
000077b0  20 69 74 65 6d 20 69 73  20 6c 69 6e 6b 65 64 20  | item is linked |
000077c0  77 69 74 68 20 73 75 62  6d 65 6e 75 20 6f 72 0a  |with submenu or.|
000077d0  64 69 61 6c 6f 67 20 62  6f 78 20 64 65 70 65 6e  |dialog box depen|
000077e0  64 69 6e 67 20 6f 6e 20  63 6f 6e 74 65 6e 74 73  |ding on contents|
000077f0  20 6f 66 20 52 31 2e 20  54 6f 20 63 6f 6e 6e 65  | of R1. To conne|
00007800  63 74 20 73 75 62 6d 65  6e 75 20 52 31 20 6d 61  |ct submenu R1 ma|
00007810  79 0a 63 6f 6e 74 61 69  6e 20 6d 65 6e 75 20 68  |y.contain menu h|
00007820  61 6e 64 6c 65 20 28 61  73 20 72 65 74 75 72 6e  |andle (as return|
00007830  65 64 20 62 79 20 22 3c  4d 65 6e 75 55 74 69 6c  |ed by "<MenuUtil|
00007840  5f 4e 65 77 3e 22 29 20  6f 72 20 61 62 73 6f 6c  |_New>") or absol|
00007850  75 74 65 20 70 6f 69 6e  74 65 72 20 74 6f 0a 74  |ute pointer to.t|
00007860  68 65 20 6d 65 6e 75 20  64 61 74 61 20 73 74 72  |he menu data str|
00007870  75 63 74 75 72 65 2e 20  54 6f 20 63 6f 6e 6e 65  |ucture. To conne|
00007880  63 74 20 64 69 61 6c 6f  67 20 62 6f 78 20 52 31  |ct dialog box R1|
00007890  20 6d 75 73 74 20 63 6f  6e 74 61 69 6e 20 77 69  | must contain wi|
000078a0  6e 64 6f 77 0a 68 61 6e  64 6c 65 20 6f 66 20 64  |ndow.handle of d|
000078b0  69 61 6c 6f 67 20 62 6f  78 20 28 61 73 20 72 65  |ialog box (as re|
000078c0  74 75 72 6e 65 64 20 62  79 20 22 3c 57 69 6d 70  |turned by "<Wimp|
000078d0  5f 43 72 65 61 74 65 57  69 6e 64 6f 77 3d 3e 53  |_CreateWindow=>S|
000078e0  57 49 2e 57 69 6d 70 5f  43 72 65 61 74 65 57 69  |WI.Wimp_CreateWi|
000078f0  6e 64 6f 77 3e 22 29 2e  0a 0a 3c 45 78 61 6d 70  |ndow>")...<Examp|
00007900  6c 65 20 63 6f 64 65 2e  2e 2e 3d 3e 45 78 5f 53  |le code...=>Ex_S|
00007910  75 62 6d 65 6e 75 3e 45  78 61 6d 70 6c 65 20 63  |ubmenu>Example c|
00007920  6f 64 65 20 28 4d 65 6e  75 55 74 69 6c 5f 43 6f  |ode (MenuUtil_Co|
00007930  6c 6f 75 72 4d 65 6e 75  29 0a 43 72 65 61 74 65  |lourMenu).Create|
00007940  20 63 6f 6c 6f 75 72 20  73 65 74 74 69 6e 67 20  | colour setting |
00007950  6d 65 6e 75 3a 0a 0a 20  20 53 59 53 20 22 4d 65  |menu:..  SYS "Me|
00007960  6e 75 55 74 69 6c 5f 43  6f 6c 6f 75 72 4d 65 6e  |nuUtil_ColourMen|
00007970  75 22 2c 2c 22 43 6f 6c  6f 75 72 22 20 54 4f 20  |u",,"Colour" TO |
00007980  63 6f 6c 6f 75 72 4d 65  6e 75 25 4d 65 6e 75 55  |colourMenu%MenuU|
00007990  74 69 6c 5f 43 6f 6c 6f  75 72 4d 65 6e 75 20 28  |til_ColourMenu (|
000079a0  53 57 49 20 26 34 35 42  43 46 29 0a 43 72 65 61  |SWI &45BCF).Crea|
000079b0  74 65 73 20 61 20 77 69  6d 70 20 63 6f 6c 6f 75  |tes a wimp colou|
000079c0  72 20 73 65 74 74 69 6e  67 20 6d 65 6e 75 0a 45  |r setting menu.E|
000079d0  6e 74 72 79 3a 0a 20 20  20 20 52 31 20 2d 3e 20  |ntry:.    R1 -> |
000079e0  6d 65 6e 75 20 74 69 74  6c 65 20 73 74 72 69 6e  |menu title strin|
000079f0  67 0a 20 20 20 20 52 32  20 2d 3e 20 6d 65 6e 75  |g.    R2 -> menu|
00007a00  20 68 61 6e 64 6c 65 0a  45 78 69 74 3a 20 20 20  | handle.Exit:   |
00007a10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 0a 20  |              . |
00007a20  20 20 20 52 30 20 3d 20  68 61 6e 64 6c 65 20 6f  |   R0 = handle o|
00007a30  66 20 74 68 65 20 6d 65  6e 75 0a 20 20 20 20 52  |f the menu.    R|
00007a40  31 20 70 72 65 73 65 72  76 65 64 0a 0a 54 68 69  |1 preserved..Thi|
00007a50  73 20 63 61 6c 6c 20 63  72 65 61 74 65 73 20 73  |s call creates s|
00007a60  74 61 6e 64 61 72 64 20  57 49 4d 50 20 63 6f 6c  |tandard WIMP col|
00007a70  6f 75 72 0a 73 65 74 74  69 6e 67 20 6d 65 6e 75  |our.setting menu|
00007a80  2e 20 52 31 20 6f 6e 20  65 6e 74 72 79 20 70 6f  |. R1 on entry po|
00007a90  69 6e 74 73 20 74 6f 20  74 68 65 0a 74 69 74 6c  |ints to the.titl|
00007aa0  65 20 73 74 72 69 6e 67  20 66 6f 72 20 74 68 65  |e string for the|
00007ab0  20 6d 65 6e 75 2e 20 49  66 20 52 32 3c 3e 30 20  | menu. If R2<>0 |
00007ac0  74 68 65 6e 0a 69 74 20  70 6f 69 6e 74 73 20 74  |then.it points t|
00007ad0  6f 20 74 68 65 20 68 61  6e 64 6c 65 72 20 63 6f  |o the handler co|
00007ae0  6d 6d 6f 6e 20 66 6f 72  20 61 6c 6c 0a 31 36 20  |mmon for all.16 |
00007af0  69 74 65 6d 73 2e 20 28  53 65 65 20 61 6c 73 6f  |items. (See also|
00007b00  20 22 3c 4d 65 6e 75 55  74 69 6c 5f 41 64 64 3e  | "<MenuUtil_Add>|
00007b10  22 20 66 6f 72 0a 6d 6f  72 65 20 69 6e 66 6f 20  |" for.more info |
00007b20  61 62 6f 75 74 20 69 74  65 6d 20 68 61 6e 64 6c  |about item handl|
00007b30  65 72 73 29 2e 20 44 65  73 70 69 74 65 0a 74 68  |ers). Despite.th|
00007b40  65 20 66 61 63 74 20 74  68 61 74 20 74 68 65 20  |e fact that the |
00007b50  73 61 6d 65 20 68 61 6e  64 6c 65 72 20 69 73 20  |same handler is |
00007b60  69 6e 76 6f 6b 65 64 0a  77 69 74 68 20 61 6c 6c  |invoked.with all|
00007b70  20 69 74 65 6d 73 20 69  74 20 69 73 20 73 74 69  | items it is sti|
00007b80  6c 6c 20 70 6f 73 73 69  62 6c 65 20 74 6f 0a 64  |ll possible to.d|
00007b90  69 73 74 69 6e 67 75 69  73 68 20 75 73 65 72 20  |istinguish user |
00007ba0  73 65 6c 65 63 74 69 6f  6e 2e 20 3c 4d 65 6e 75  |selection. <Menu|
00007bb0  55 74 69 6c 5f 44 65 63  6f 64 65 3e 0a 72 65 74  |Util_Decode>.ret|
00007bc0  75 72 6e 73 20 6e 6f 74  20 6f 6e 6c 79 20 70 6f  |urns not only po|
00007bd0  69 6e 74 65 72 20 74 6f  20 74 68 65 20 68 61 6e  |inter to the han|
00007be0  64 6c 65 72 0a 62 75 74  20 61 6c 73 6f 20 74 68  |dler.but also th|
00007bf0  65 20 6e 75 6d 62 65 72  20 28 70 6f 73 69 74 69  |e number (positi|
00007c00  6f 6e 29 20 6f 66 20 73  65 6c 65 63 74 65 64 0a  |on) of selected.|
00007c10  69 74 65 6d 20 69 6e 20  74 68 65 20 6d 65 6e 75  |item in the menu|
00007c20  2e 20 41 63 74 75 61 6c  6c 79 20 74 68 69 73 20  |. Actually this |
00007c30  6e 75 6d 62 65 72 20 69  73 0a 65 71 75 61 6c 20  |number is.equal |
00007c40  74 6f 20 74 68 65 20 63  6f 6c 6f 75 72 20 6e 75  |to the colour nu|
00007c50  6d 62 65 72 2e 0a 0a 3c  45 78 61 6d 70 6c 65 20  |mber...<Example |
00007c60  63 6f 64 65 2e 2e 2e 3d  3e 45 78 5f 43 6f 6c 6f  |code...=>Ex_Colo|
00007c70  75 72 4d 65 6e 75 3e 45  78 61 6d 70 6c 65 20 63  |urMenu>Example c|
00007c80  6f 64 65 20 28 4d 65 6e  75 55 74 69 6c 5f 43 6f  |ode (MenuUtil_Co|
00007c90  6c 6f 75 72 73 29 0a 43  68 61 6e 67 65 20 63 6f  |lours).Change co|
00007ca0  6c 6f 75 72 73 20 6f 66  20 63 75 72 72 65 6e 74  |lours of current|
00007cb0  20 69 74 65 6d 20 74 6f  20 62 6c 61 63 6b 20 6f  | item to black o|
00007cc0  6e 20 79 65 6c 6c 6f 77  3a 0a 0a 20 20 53 59 53  |n yellow:..  SYS|
00007cd0  20 22 4d 65 6e 75 55 74  69 6c 5f 43 6f 6c 6f 75  | "MenuUtil_Colou|
00007ce0  72 73 22 2c 2c 37 2c 39  4d 65 6e 75 55 74 69 6c  |rs",,7,9MenuUtil|
00007cf0  5f 43 6f 6c 6f 75 72 73  20 28 53 57 49 20 26 34  |_Colours (SWI &4|
00007d00  35 42 44 30 29 0a 53 65  74 73 20 6e 65 77 20 66  |5BD0).Sets new f|
00007d10  6f 72 65 67 72 6f 75 6e  64 20 61 6e 64 20 62 61  |oreground and ba|
00007d20  63 6b 67 72 6f 75 6e 64  20 63 6f 6c 6f 75 72 73  |ckground colours|
00007d30  20 6f 66 20 6d 65 6e 75  20 69 74 65 6d 0a 0a 45  | of menu item..E|
00007d40  6e 74 72 79 3a 0a 20 20  20 20 52 30 20 3d 20 68  |ntry:.    R0 = h|
00007d50  61 6e 64 6c 65 20 6f 66  20 74 68 65 20 6d 65 6e  |andle of the men|
00007d60  75 20 69 74 65 6d 20 6f  72 20 7a 65 72 6f 20 66  |u item or zero f|
00007d70  6f 72 20 63 75 72 72 65  6e 74 20 69 74 65 6d 0a  |or current item.|
00007d80  20 20 20 20 52 31 20 3d  20 66 6f 72 65 67 72 6f  |    R1 = foregro|
00007d90  75 6e 64 20 63 6f 6c 6f  75 72 0a 20 20 20 20 52  |und colour.    R|
00007da0  32 20 3d 20 62 61 63 6b  67 72 6f 75 6e 64 20 63  |2 = background c|
00007db0  6f 6c 6f 75 72 0a 45 78  69 74 3a 0a 20 20 20 20  |olour.Exit:.    |
00007dc0  52 30 2d 52 32 20 70 72  65 73 65 72 76 65 64 0a  |R0-R2 preserved.|
00007dd0  0a 54 68 69 73 20 63 61  6c 6c 20 61 6c 6c 6f 77  |.This call allow|
00007de0  73 20 79 6f 75 20 74 6f  20 63 68 61 6e 67 65 20  |s you to change |
00007df0  63 6f 6c 6f 75 72 73 20  6f 66 20 70 61 72 74 69  |colours of parti|
00007e00  63 75 6c 61 72 20 6d 65  6e 75 20 69 74 65 6d 2e  |cular menu item.|
00007e10  20 43 6f 6c 6f 75 72 73  20 6d 75 73 74 0a 62 65  | Colours must.be|
00007e20  20 73 65 6c 65 63 74 65  64 20 66 72 6f 6d 20 31  | selected from 1|
00007e30  36 20 57 69 6d 70 20 63  6f 6c 6f 75 72 73 2e 0a  |6 Wimp colours..|
00007e40  0a 3c 45 78 61 6d 70 6c  65 20 63 6f 64 65 2e 2e  |.<Example code..|
00007e50  2e 3d 3e 45 78 5f 43 6f  6c 6f 75 72 73 3e 45 78  |.=>Ex_Colours>Ex|
00007e60  61 6d 70 6c 65 20 63 6f  64 65 20 28 4d 65 6e 75  |ample code (Menu|
00007e70  55 74 69 6c 5f 54 69 63  6b 4f 6e 6c 79 29 0a 54  |Util_TickOnly).T|
00007e80  69 63 6b 20 62 6c 61 63  6b 20 63 6f 6c 6f 75 72  |ick black colour|
00007e90  20 69 6e 20 63 6f 6c 6f  75 72 20 6d 65 6e 75 3a  | in colour menu:|
00007ea0  0a 0a 20 20 53 59 53 20  22 4d 65 6e 75 55 74 69  |..  SYS "MenuUti|
00007eb0  6c 5f 54 69 63 6b 4f 6e  6c 79 22 2c 63 6f 6c 6f  |l_TickOnly",colo|
00007ec0  75 72 4d 65 6e 75 25 2c  37 4d 65 6e 75 55 74 69  |urMenu%,7MenuUti|
00007ed0  6c 5f 54 69 63 6b 4f 6e  6c 79 20 28 53 57 49 20  |l_TickOnly (SWI |
00007ee0  26 34 35 42 44 31 29 0a  54 69 63 6b 20 6f 6e 6c  |&45BD1).Tick onl|
00007ef0  79 20 73 70 65 63 69 66  69 65 64 20 6d 65 6e 75  |y specified menu|
00007f00  20 69 74 65 6d 0a 0a 45  6e 74 72 79 3a 0a 20 20  | item..Entry:.  |
00007f10  20 20 52 30 20 3d 20 68  61 6e 64 6c 65 20 6f 66  |  R0 = handle of|
00007f20  20 74 68 65 20 6d 65 6e  75 20 69 74 65 6d 20 6f  | the menu item o|
00007f30  72 20 7a 65 72 6f 20 66  6f 72 20 63 75 72 72 65  |r zero for curre|
00007f40  6e 74 20 69 74 65 6d 2c  20 6f 72 0a 20 20 20 20  |nt item, or.    |
00007f50  20 20 20 20 20 0a 20 20  20 20 52 30 20 3d 20 68  |     .    R0 = h|
00007f60  61 6e 64 6c 65 20 6f 66  20 74 68 65 20 6d 65 6e  |andle of the men|
00007f70  75 0a 20 20 20 20 52 31  20 3d 20 69 74 65 6d 20  |u.    R1 = item |
00007f80  70 6f 73 69 74 69 6f 6e  20 69 6e 20 74 68 65 20  |position in the |
00007f90  6d 65 6e 75 20 28 73 74  61 72 74 69 6e 67 20 66  |menu (starting f|
00007fa0  72 6f 6d 20 7a 65 72 6f  29 0a 45 78 69 74 3a 0a  |rom zero).Exit:.|
00007fb0  20 20 20 20 52 30 2c 52  31 20 70 72 65 73 65 72  |    R0,R1 preser|
00007fc0  76 65 64 0a 0a 54 68 69  73 20 63 61 6c 6c 20 74  |ved..This call t|
00007fd0  69 63 6b 73 20 73 70 65  63 69 66 69 65 64 20 69  |icks specified i|
00007fe0  74 65 6d 20 61 6e 64 20  63 6c 65 61 72 73 20 74  |tem and clears t|
00007ff0  69 63 6b 20 66 6c 61 67  73 20 69 6e 20 72 65 6d  |ick flags in rem|
00008000  61 69 6e 69 6e 67 20 69  74 65 6d 73 20 69 6e 0a  |aining items in.|
00008010  74 68 65 20 6d 65 6e 75  2e 20 49 66 20 79 6f 75  |the menu. If you|
00008020  20 64 6f 6e 27 74 20 6b  6e 6f 77 20 74 68 65 20  | don't know the |
00008030  68 61 6e 64 6c 65 20 6f  66 20 74 68 65 20 6d 65  |handle of the me|
00008040  6e 75 20 74 68 65 6e 20  79 6f 75 20 63 61 6e 20  |nu then you can |
00008050  73 70 65 63 69 66 79 0a  68 61 6e 64 6c 65 20 6f  |specify.handle o|
00008060  66 20 74 68 65 20 6d 65  6e 75 20 69 6e 20 52 30  |f the menu in R0|
00008070  20 61 6e 64 20 70 6f 73  69 74 69 6f 6e 20 6f 66  | and position of|
00008080  20 74 68 65 20 69 74 65  6d 20 69 6e 20 52 31 2e  | the item in R1.|
00008090  0a 0a 3c 45 78 61 6d 70  6c 65 20 63 6f 64 65 2e  |..<Example code.|
000080a0  2e 2e 3d 3e 45 78 5f 54  69 63 6b 4f 6e 6c 79 3e  |..=>Ex_TickOnly>|
000080b0