MNUBARCHC (Menu-Bar Choice) Keyword for Display Files--Examples

Figure 203, Figure 204, and Figure 205 show how to specify the MNUBARCHC keyword.

Figure 203. Specifying the MNUBARCHC Keyword (Example 1)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A                                      DSPSIZ(*DS3 *DS4)
A          R MENUBAR                   MNUBAR
A            MNUFLD         2Y 0B  1  2
A                                      MNUBARCHC(1 PULLFILE +
A                                         '>File          ')
A  01                                  MNUBARCHC(2 PULLEDIT +
A                                         '>Edit          ')
A                                      MNUBARCHC(3 PULLVIEW +
A                                         '>View          ')
A                                      MNUBARCHC(4 PULLOPT +
A                                         '>Options       ' &RTNFLD);
A                                      MNUBARCHC(5 PULLHELP +
A                                         '>Help          ')
A            RTNFLD         2Y 0H

In Figure 203, five menu bar choices (File, Edit, View, Options and Help) are defined in a menu bar. If option indicator 01 is on and the menu bar record is written before the system displays it, the Edit choice is displayed when the system displays the menu bar. If option indicator 01 is off or the menu-bar record is not written before the system displays it, the Edit choice is not displayed. If the Edit choice is not displayed, the list of choices are compressed and the View choice will follow the File choice, with 3 blank spaces in between.

If the File choice is selected, record PULLFILE is displayed as a pull-down menu beneath the File choice. If the Options choice is selected, control is returned to the application. The application can update the PULLOPT record before the system displays it as a pull-down menu.

On displays capable of a single-character underline, the mnemonic for each choice is the first character in the text. If the menu-bar record is read, the menu-bar field MNUFLD contains the number of the choice selected, or 0 if no choice was selected.

The text for each choice has been specified as a character string, with 15 spaces available for the text. However, the trailing blanks are removed before the system calculates how many choices fit on a line. Therefore, the maximum space required for the menu bar is 87 positions (28 for the text within the character strings, plus 3 spaces between each choice). The menu-bar choices occupy one line. The menu-bar separator occupies one more line; therefore the entire menu bar occupies two lines.

Figure 204. Specifying the MNUBARCHC Keyword (Example 2)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
DSPSIZ(*DS3 *DS4)
A          R MENUBAR                   MNUBAR
A            MNUFLD         2Y 0B  1  2
A                                      MNUBARCHC(1 PULLFILE +
A                                         &FILETXT);
A  01                                  MNUBARCHC(2 PULLEDIT +
A                                         &EDITTXT);
A                                      MNUBARCHC(3 PULLVIEW +
A                                         &VIEWTXT);
A                                      MNUBARCHC(4 PULLOPT +
A                                         &OPTTXT &RTNFLD);
A                                      MNUBARCHC(5 PULLHELP +
A                                         &HELPTXT);
A           FILETXT       15A  P
A           EDITTXT       15A  P
A           VIEWTXT       15A  P
A           OPTTXT        15A  P
A           HELPTXT       15A  P
A           RTNFLD         2Y 0H
A

Figure 204 is the same as Figure 203, except that the choice text has been specified using program-to-system fields.

At run time, the choice text to be displayed for each choice is retrieved from the program-to-system fields. Any mnemonics must be specified in the text supplied by the application at run time. As Figure 203 when the menu-bar record is read, the menu-bar field MNUFLD contains the number of the choice selected, or 0 if no choice was selected.

As in Figure 203, the number of spaces available for the text for each choice is 15. The maximum space required for the menu bar is 78 positions (15 possible text positions for each of the 5 choices plus 3 spaces between choices). Because the smallest display size is 24x80 (*DS3), the menu-bar choices occupy 2 lines. The menu-bar separator occupies one more line, so the entire menu bar occupies 3 lines. However, the actual number of lines that is used to display the choices depends on the text that is contained in the program-to-system fields. When the menu bar is displayed, the trailing blanks in the P-fields are truncated, and 3 blanks are inserted between each choice.

Figure 205. Specifying the MNUBARCHC Keyword (Example 3)

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A          R MENUBAR                   MNUBAR
A            MNUFLD         2Y 0B  1  2
A                                      MNUBARCHC(1 PULLFILE +
A                                         '>File        ')
A                                      MNUBARCHC(2 PULLEDIT +
A                                         '>Edit        ' &RTNFLD);
A            RTNFLD         2Y 0H

In Figure 205, if choice 2 in the menu bar is selected, control is returned to the application and field RTNFLD contains the number 2. Field MNUFLD contains 0, indicating no pull-down input received. The application must read record MENUBAR in order to get the contents of field RTNFLD. The application must then write record PULLEDIT. The system resumes control of the menu-bar interaction. If input is then entered in record PULLEDIT, control is returned to the application, and field MNUFLD contains number 2. Field RTNFLD contains 0, indicating control has been returned because pull-down input was received.

If choice 1 is selected, the system displays pull-down record PULLFILE. If input is entered in PULLFILE, control is returned to the application, and field MNUFLD contains number 1. Field RTNFLD contains 0, indicating control has been returned because pull-down input was received.