The menu screen is similar to the development screen on which the C/Base forms are designed. the menu screen is created by by typing the background text and entering the desired menu choices.
With the cursor positioned in the upper left-hand corner of the screen, press the Tab key once and type:
Demonstration Subscription System
This is called background text because there are no commands associated with this text.
Next, a menu choice is added. Move the cursor to column 16 of line 4 (press RETURN three times and the Tab key twice) and press the ADD key <F6> to display the Choice Description screen.
Notice that the screen is in ADD mode. This screen also displays two fields, labeled Choice name and Choice Commands. A menu choice is entered into the Choice name field exactly as it is to appear on the menu. The commands that are to be executed when this choice is selected are entered into the Choice Commands field. This field may contain any internal menu command or any other valid command which may be executed from within the operating system. Some of the most commonly used commands is described in the following paragraphs before continuing with our example.
Form is the command that displays a data entry screen. The syntax for this command is:
form [-qfuadvk] formfile
where form is the command, -qfuadvk are the command flags, and formfile refers to the logical name of the file containing the form definition. For more information about the formfile argument see form(C-1) in C/Base Reference Manual Chapter 12, C/Base Commands, or C/Base Reference Manual Chapter 3, Using Form.
The form command flags (-q, -f, -u, -a, -d, -v, and -k) provide controlled access to an RMSfile through a data entry form. Descriptions of these flags are as follows:
Flag - Description
-q - QUERY allowed
-f - FIND allowed
-u - UPDATE allowed
-a - ADD allowed
-d - DELETE allowed
-v - selected modes allowed while in VALIDATION form
-k - interrupt key enabled
These flags may be grouped in any order to provide customized activity on a particular form. For instance, to restrict access to an RMSfile so that a user may examine the information in the file but may not modify it in any way (changing records, adding new records, or removing current records), only the QUERY and FIND flags would be specified:
form -qf formfile
To permit the user to modify current records, add the UPDATE flag:
form -qfu formfile
(Note: The GOLD and EXIT functions are always allowed within a data entry form, as is the NEXTFORM function when one form is followed by another. The STORE function is only allowed when the form is in UPDATE or ADD mode.)
Grace is the command used for generating reports. The syntax of the grace command is:
grace [-w] [#copies] rptfile
where -w and #copies are command flags and rptfile is the logical name of the report program to be processed. For more information about the rptfile argument, see grace(C-1) in C/Base Reference Manual Chapter 12, C/Base Commands or C/Base Reference Manual Chapter 9, Report Writer Programming Guide. Since the grace commands flags will not be used in this volume, their usage will not be covered at this time. (Note: More information regarding the grace command and its flags is available in C/Base Reference Manual Chapter 9, Report Writer Programming Guide.)
Menu is the command entered in the Choice Command field to access another menu from within the current menu. This internal menu command is written:
Execution of this command causes the menu currently displayed to be replaced by the menu named in the menuname argument. This command is recognized only if it is the last, or only, command in the Choice Commands field.
Quit is another internal menu command. Its purpose is to exit the menu and return to the system level from which the menu was entered initially (i.e., usually the operating system itself). The syntax of this command is:
This command, like the internal menu command, is recognized only if it is the last, or only, command in the Choice Commands field. When creating menus, it is required that every menu contain at least one menu or quit command. Otherwise, it would not be possible to exit from the menu. In addition to these, there are other commands which may be used within a menu but which will not be covered at this time. Information on these commands may be found in C/Base Reference Manual Chapter 8, Creating Menus.
Now, getting back to our example, type:
1 - Enter Magazines
into the Choice name field. In this example, the menu choice starts with a number, which allows the user to choose the desired selection simply by typing a number. Next, move the cursor to the Choice Commands field and type:
form -qfuad mag
Press the STORE key <F5>.
The menu selection just added via the Choice Description screen now appears on the menu screen. When the cursor is positioned on a menu selection, the selection is highlighted by being displayed in reverse video. Note that the first line of the Command Choice field associated with that menu choice is displayed at the bottom of the screen.
Move the cursor down one line (line 5, column 16) then press the ADD key <F6> to enter the next menu choice. The Choice Description form is displayed.
The Choice Commands entry for this menu selection includes a special program, sform, which is part of the standard Demonstration Subscription System. Since it is not located in the current directory (i.e., demo.smj), and the directory in which it is found (i.e., the \demo directory which is located in the cbase directory) is not in the standard path used when processing C/Base software, it must be copied to the current directory. Using sform rather than the standard form command causes special editing to be performed within this form during data entry. (Note: More information on this means of editing may be found in the C/Base Reference Manual and C/Base Utilities Manual.)
After entering the data press the STORE key <F5> to redisplay the menu screen.
As has now been seen, menu choices are entered by simply positioning the cursor on the menu screen at the location where you wish it to appear on the menu. The ADD key <F6> is then pressed and the Choice Description screen is displayed. Both the Choice name and Choice Commands are entered in the Choice Description screen. Once the entries in these fields are complete, the STORE key <F5> is again pressed and the menu screen is redisplayed. Other menu choices may then be added to the menu.
To complete your version of the Demonstration Subscription System menu, add the following menu selections:
Line 8, Column 16
Choice name: 3 - List Subscribers
Choice Commands: grace sub
Line 9, Column 16
Choice name: 4 - List Subscriptions
Choice Commands: grace scriptm
Line 10, Column 16
Choice name: 5 - List Magazines
Choice Commands: grace mag
Line 11, Column 16
Choice name: 6 - List Subscriber Labels
Choice Commands: grace labels
Line 14, Column 16
Choice name: X - exit
Choice Commands: quit
After the above menu selections have been entered and stored, the menu is complete. Press the EXIT key <F8> to write the menu to its file and redisplay the Menus Menu. You may test the new menu by choosing choice D3 - Test the Application Menu from the Menus Menu and pressing the RETURN key.