<<

Contents

Search

>>

 

ADD_MENU

 

 

Function

 

 

Syntax:

ADD_MENU(<Menu Level>,<Mainmenu>,<Submenu>,<Macroname>)

 

<Menu Level>

= <STRING-EXPRESSION>

<Mainmenu>

= <STRING-EXPRESSION>

<Submenu>

= <STRING-EXPRESSION>

<Macroname>

= <MACRONAME>

 

 

Meaning:

The function ADD_MENU creates a branch of the menu tree, which is displayed in the main window.

 

When creating a menu the following steps have to be taken:

 

1. Create branches of the menu with the function ADD_MENU

2. Start the menu with START_MENU .

 

ADD_MENU returns the following values:

 

Returncode

Meaning

0

No error

6001

Faulty or invalid menu level

 

Parameter:

Menu Level

Specifies where in the menu tree the new branch is positioned. <Menu Level> may only consist of numbers and points between the numbers.

 

Examples:

"1" defines menu level 1.

"1.2" refers to the second submenu item of menu level "1".

"1.2.1" refers to the 1st submenu item of menu level "1.2".

 

The top menu levels ("1", "2", ...) do not have to be ascending in a gapless order. They do not have to be defined by the function ADD_MENU in ascending order either. Subordinate menu branches can only be defined, however, if the respective higher branch already exists. 

Main menu

Specifies the name of the higher menu item.

 

If a subordinate menu branch is created, the name submenu name is replaced for the main menu name in the higher menu item.

 

Example:

H% = ADD_MENU("1","File","Create;Close;;Exit"

H% = ADD_MENU("1.2","Open","Image file;Text file"

 

The 2nd menu item is no longer called Create but Open.

 

Submenu

In <Submenu> the names of the submenu items are listed and separated by semi-colons. Empty entries are allowed. An empty entry creates a separator line in the menu. At the beginning of a submenu name two images, separated by commas, can be specified. The first image @<Image-1> is displayed if the menu item is not selected, the second image @<Image-2> is displayed if the menu item is selected.

 

Thus a submenu item has the following structure:

 

[@<Image-1>,[@<Image-2>,]]<Submenu Name>

 

In the individual names (main- and submenu) the character ‘&’ can be used in order to stress a character. The menu item can then be selected by ALT/<character>.

 

In the name also a control- or function key can be specified. The key must stand at the end of the name and be separated by a blank, e.g. "Read  CTRL/A".

 

Macroname

The macro is called if a menu item has been selected. It is allowed to use the same macro with several menu branches. When the macro is executed the variable EBUS_MENU$ contains the name of the selected menu item.

 

Sample:

H% = ADD_MENU("1","&File","&Open;&Delete;&Show",MEN.MACRO)

IF H%<>0 THEN ... Error... ENDIF

H% = ADD_MENU("2","&Print  F8","@single.gif,&Single;;@all.gif,&All",MEN.MACRO)

IF H%<>0 THEN ... Error... ENDIF

H% = ADD_MENU("3","&Exit CTRL/E","",MEN.MACRO)

IF H%<>0 THEN ... Error... ENDIF

H% = ADD_MENU("2.3","&All","&AscendingA&Descending",MEN.MACRO)

IF H%<>0 THEN ... Error... ENDIF

 

See also:

DEL_MENU

START_MENU

EBUS_MENU$

ACTIVATE

DEACTIVATE

ADD_POPUPMENU

ENDMENU