MENU statement provides your 4GL program with a ring menu. The user can choose menu options from the keyboard or with the help of the mouse and execute the corresponding blocks of statements.
Title |
A character expression that returns a character string serving as the title of the menu |
Attribute Clause | The block that has the menu display attributes |
Menu control block |
Block that contains menu commands |
Statements |
Executable statements and special keywords which are executed when the corresponding menu command in activated |
The MENU statement can be used to create and display the menu together with its title and the menu buttons that trigger menu options, specify a help message and description for each menu option.
4GL performs the actions when it encounters the MENU statement:
The menu title is displayed together with the menu options which fit the length of the first menu line (the options that do not fit the screen can be viewed by pressing arrow buttons on both sides of the first menu line, or by means of LEFT and RIGHT arrow keys on the keyboard).
The cursor is moved to the first menu option and the description message for this option is displayed, if any.
4GL waits until the user presses the menu button or an activation key or terminates the MENU by means of the Quit key or Interrupt key.
If the activation key is pressed, the statements of the corresponding Control Block are executed.
Statements clauses can contain:
When 4GL executes the last statement of a Statement clause, it redisplays the menu.
A menu cannot occur within a screen form, it should be located either above or below it. The menu is positioned in the MENU line, which is by default the first line of the 4GL screen or a 4GL window. This setting can be changed with the help of the MENU LINE option of the closest OPTIONS statement or OPEN WINDOW statement.
A runtime error occurs unless the 4GL screen can contain at least the menu title and one menu option.
One MENU statement can be nested in another MENU statement. The nested MENU statement can occur in a statement block within the other MENU statement, or in a function that is called from another MENU control clause.
In Informix compatibility mode, MENU statement specifies and displays the ring menu which occupies the first two lines of the 4GL screen: the first line contains the menu buttons and the second line displays the description of the currently highlighted menu option.
When you call INPUT, INPUT ARRAY, or DISPLAY ARRAY statements from MENU, you must explicitly specify the end of the embedded statement (by END INPUT or END DISPLAY). Otherwise, you will get the compilation error because the compiler will not understand the order of statements and their clauses: