Amos Professional Manual  Contents  Index

Menus


CHOICE(2) will return the value of the option number which has been selected.

Now remove the Wait Key from the last example, and replace it with the following lines. This should change the shape of the mouse cursor, depending on the option selected from your menu. Note that Choice=-1 can be simplified to Choice.

E> Do
    If Choice and Choice(1)=1 Then Exit
    If Choice(1)=2 and Choice(2)<>0 Then Change Mouse Choice(2)
   Loop

Creating advanced menus
The use of MENU$ and CHOICE is not limited to the creation of simple menus. In fact, their use can be extremely sophisticated.

MENU$ is used to define the appearance of each individual item in one of your menus, whether it is a title, an option, a sub-option, all the way down to the eighth layer of options in the menu hierarchy. In this Chapter, when "single item parameters" is used it simply means those numbers separated by commas and held inside a single pair of brackets, that refer to the position of a single item somewhere in the menu. Up to eight parameters can be used, separated by commas. To make sure that is clear, here are some examples of parameters defining the position of a single item in the menu hierarchy:

X> Menu$(1)="Title1"
   Menu$(1 ,1)="Title1 Option1"
   Menu$(2,3)="Title2, Option2"
   Menu$(1,1,1,1)="Title1, Option1, Sub-option1, Sub-sub-option1"

Now look at these uses of MENU$, which are used to give a single item its own characteristics:

MENU$
instruction: define appearance of a single item in a menu
Menu$(single item parameters)=normal$
Menu$(single item parameters)=normal$,selected$,inactive$,background$

Normal$ is simply the string of characters that make up the normal appearance of an item when it is displayed on screen. The following strings are all optional.

The selected$ changes the appearance of the item when it is selected by the mouse. As a default, selected items are highlighted by printing the string in inverse text.

The inactive$ comes into effect when an item has been deactivated using the MENU INACTIVE command, which is explained later. It can be used to display alternative text or appearance, but if it is omitted, inactive items are automatically displayed in italics.

The background$ creates a background effect for menu items when they are initially drawn, such as a box or a border created by the internal BAR or line drawing commands.

Back    Next
06.05.03