Amos Professional Manual  Contents  Index

Menus


The second type of usage of MENU$ defines a set of options that will be displayed in the vertical menu bar. The brackets after MENU$ contain two parameters, the first is the number of the menu heading that your option is to be displayed beneath, followed by the option number you want to install in the vertical menu bar. All options are numbered downwards from the top of the menu, starting from 1. The option string holds the name of your new option, and can consist of any text you choose. The following lines could be added to the last example above:

E> Rem Action menu has one option
   Menu$(1,1)=" Quit " : Rem Ensure three spaces after Quit
   Rem Mouse menu has three options
   Menu$(2,1)="Arrow " : Rem Ensure five spaces after Arrow
   Menu$(2,2)="Cross-hair"
   Menu$(2,3)="Clock " : Rem Ensure five spaces after Clock

That specifies your list of alternatives for the "Action" and "Mouse" menus. Before this program can be run, it must first be activated.

MENU ON
instruction: activate a menu
Menu On

Use this command to initialise the menu previously defined by a MENU$, and the menu line will appear when the right mouse button is pressed. To activate the previous example, add the following lines:

E> Menu On
   Wait Key

Trigger the menu and its options now, and use the left mouse button to re-locate the title bar. Now that this simple menu has been activated, the selected options must be read and reported back to the system.

Reading a simple menu

CHOICE
function: read a menu
selection=Choice
title number=Choice(1)
option number=Choice(2)

CHOICE will return a value of -1 (true) if the menu has been highlighted by the user, otherwise a value of 0 (false) is returned. After the status of your menu is tested, the value held by CHOICE is automatically re-set to zero.

CHOICE(1) will return the value of the title number which has been chosen.

Back    Next
06.05.02