|
||
Custom Menus
|
|
|||||||||
|
SilverScreen allows the use of custom menus. These menus, in appearance and in functionality, are very similar to the SilverScreen menus. The menus can be displayed using the built-in function menu. Using this function, a program can display a menu and receive the user's response.
The construction of custom menus begins with a source file that defines the structure of the menus. This file is then compiled to produce a .CMF file. It is the .CMF file that is used by the menu function.
This is a simple menu consisting of three major menu selections (ceiling, floor, quit). The ceiling and floor selections have secondary menus, while the quit selection does not. The quoted strings are single line descriptors that appear at the top of the screen when the corresponding selection is highlighted.
The numbers at the right are returned to the program if the user selects that item. Note that these numbers appear only at the leaf level of the menu tree.
Let us assume that above source menu is stored in the file SAMPLE1. The file is compiled using the following SilverScreen command:
This will produce, in this example, a custom menu file SAMPLE1.CMF, which will be stored in the current directory. The CMF file may now be used by the menu function:
The menu command returns 0, 1, or a number corresponding to a menu selection. The return value 0 means that the user chose to enter Esc rather than select an item from the menu. The return value 1 means that the user pressed a function or control key. When this occurs, the key is made available in the predefined variable ich. The other numbers correspond to a successful menu selection by the user.
Structure of a Custom Menu File
A custom menu file has the following format:
The ‘*’ menu item denotes a menu separator.
|
|