index

Varkon application developers manual

# Menu files

The menus loaded when Varkon is started are defined by the text file pointed to by the environment variable VARKON_MDF in the Varkon start script. Menufiles are ordinary text files having names ending with `.MDF` (MenuDefinitionFile). Once the system is started, additional files can be loaded from MBS with the LOAD_MDF() procedure. You can also change the value of VARKON_MDF in the Varkon start script to point to your own application specific menufile.

Menufiles define menus, texts (t-strings) and PF-keys (accelerators) or `#include` other menufiles. If you want to use your own application specific menufile we recommend that you first `#include` the Varkon system default file and then add your own menus, texts or PF-key definitions. Here is an example....

    ! This is the menufile for "my_application"
    ! The name of the menufile is "my_application.MDF"
    ! First of all we load the system defaults
    #include "$VARKON_ROOT/mdf/english/x11.MDF"

    ! Then we create a new menu

    m200 = "NEW_MENU"
    "line 1",action_1
    "line 2",action_2
    "line 3",action_3;

    ! Note that the last line is terminated by a semicolon.
    ! We can also define some t-strings......

    t600 = "text 1"
    t601 = "text 2"
    t603 = "text 3"

    ! and program a PF-key  (F2) to pop up menu 201.

    s50 = "%27B",m201

    ! Finally we may want to indicate that our new menu
    ! number 200 above should be used as the main menu.

    Main_menu = 200

Use menu numbers from 200 and up. Numbers lower than 200 are reserved by the system. Numbers higher than 400 are illegal.

## The syntax of a menu definition is:

mn = "Menu_name"
followed by one or more lines of the following form:
"text",action
the last line terminated by a semicolon ;
"Menu_name" is an arbitrary heading that will be displayed at the top of the menu. "text" is an arbitrary text describing the action to take place when this alternative is selected.
action is the letter "m", "f", "M", "p", "r", or "a" followed by a number n.
"m" activates menu n.
"f" activates built in function n. See VARKON_ROOT/sources/IG/include/futab.h for function numbers.
"M" calls a MACRO module named by t-string n.
"p" calls a module named by t-string n and creates a part.
"r" same as "p" but without saving the part call in the active module.
"a" stands for "alternative" and performs no action but can be used with MBS.
The following MBS routines apply to menus: CRE_MEN(), GET_MEN(), PSH_MEN(), POP_MEN() and GET_ALT().

## t-strings are defined using the following syntax:

tn = "text"
where n must be a number from 600 up to 1500. Lower and higher numbers are reserved by the system. A t-string is just a text with a number and may be used for any purpose you can think of. The "M", "p" and "r" actions in menus rely on t-strings to store the name of the module to be called. Varkon uses the values of t-strings when displaying messages of various kinds. MBS-routines CRE_TSTR() and GET_TSTR() can be used to create a t-string and retrieve its value from MBS.

## PF-keys are defined using the following syntax:

sn = "%27c",action
where c is a character in the range "A" to "Z" and action is the same as described above for menus. "A" to "Z" gives a total number of 26 individual PF-keys or accelerators. "%27A" is PF1, "%27B" is PF2 and so on. Most keyboards don't have as many as 26 PF-keys but might emulate extra keys by the use of <SHIFT>PF1, <SHIFT>PF2 etc. s1 to s12 are reserved by Varkon for the standard PF-key setup. You may redefine any of these if you wish in your own menufile and you may also add new ones.

Varkon version 1.19C svn# 97