Since the sole function of NMENU is to cause a scripted file to execute, there is little to learn about NMENU.BAT except its syntax. The command is followed by the menu filename.
nmenu filename
Replace filename with the menu filename.
Figure 37 shows the display created by a single-window menu with only three options. Whether a menu displays one or more windows, the top and bottom bars of the screen remain the same.
The top bar always displays the NMENU version number on the left and the day, date, and time on the right. The bottom bar displays the available options.
Figure 37
A Single-Window Menu
When you create menus with multiple windows, the windows cascade from left to right (see Figure 39). Window sizing is automatically determined by the content of each window.
You create menu files with a text editor and save the file with a .SRC extension. Then you use the MENUMAKE program to compile the file. It is given a .DAT extension and, as a compiled file, is no longer editable. Any edits must be made to the .SRC file and then the .SRC file must be recompiled.
There are three primary elements to every menu: MENU, ITEM, and EXEC. As these elements are expanded and repeated, controlled options are displayed within each window.
Figure 38 shows the .SRC file used to create the menu in Figure 37. This file shows how these three elements are used. Details about these elements and their options are covered later in the chapter.
Figure 38
Primary Elements of a Menu
MENU specifies a window within the menu file. It includes a menu number and a menu name. The menu name is the title bar for the menu.
ITEM includes the text the user will see. It is given an indicator letter by default, or you can determine the character to precede it. Each option to be displayed in the window must be preceded by the word ITEM. Some options are available for the ITEM line; these options are discussed in ITEM.
EXEC is the primary command for the third element. In the menu file shown in Figure 38, EXEC issues three separate commands: a directory listing, a display of the current version of DOS running, and a command to exit the menu.
Figure 39 illustrates a menu with 10 windows, created by including 10 MENU commands in the same file. Each window is automatically sized and cascaded across the screen.
Figure 39
A Multiple-Window Menu
There are generally six steps to follow when considering a new menu. The relationship between steps is shown in Figure 40.
Figure 40
Charting the Steps in Creating a Menu
Each step in the flowchart is explained below.
Plan and design your menu. Before starting, answer the following questions:
Use a text editor to create your menu with a .SRC extension.
Compile the .SRC file with the MENUMAKE program. This will create a .DAT version of the file.
The results of any errors occurring during the compile process, including detailed error messages per line of script, are displayed on your screen. Fix the errors in the .SRC version of the file according to the error messages, and then recompile. When you have eliminated all of the errors, continue with Step 4.
Run NMENU filename.dat to verify that it does what you expect.
Change the program if needed, as described in Step 3, and then repeat Step 4. When Step 4 is successful, go on to Step 6.
Provide access to the intended users by placing the .DAT file in an appropriate directory and granting sufficient rights to the users.
NOTE: Information on placement of files and required rights is in Making Menus Work.
Following these six steps can help you learn how to use the scripting language and how to manage the menu files you create.
Use of the NMENU program is almost unlimited. When considering the uses for menus, remember that they can be as simple as presenting available application programs (see Figure 41).
Figure 41
Example of a Simple Menu
They also can be more complex, such as guiding data entry for cataloging (see Figure 42).
Figure 42
Example of a More Complex Menu
The text used to create the four menus shown in this section (Figure 37, Figure 39, Figure 41, and Figure 42) is included in Example Menu Programs.
Before you look at how these menus were created, however, you should be familiar with the guidelines for planning menus and with the scripting language rules.