| Previous | Contents | Index |
Menu items consist of either a description or a description and = sign followed by either a data value or a submenu indicator. If no = sign is given, the data value is the same as the description. If the description contains spaces or special characters, it must be enclosed within quotes. Up to 5000 menu items can be handled.
Menu descriptions are displayed on the menu for the user to choose.
The data value is the value returned to the application when the menu item is chosen.
A submenu indicator consists of a "{" followed by menu elements followed by "}".
The following directives can be used with the [LINE] INPUT MENU statement:
The menu or submenu box can be placed at a given row and column. CENTER can be used in place of row and/or column to center a menu or submenu.
%at row, center
%at center, column
%at center, center
|
The %ATTACHED menu directive causes the resulting menu window to be "attached" to the SP4GL Console Window (when there is some console output). If the console window is minimized or restored, the attached menu window will minimize or be restored with it.
%attached
|
| Example 8-39 %ATTACHED menu directive |
|---|
print 'Illustrating %attached menu directive...' print print 'Minimize the SheerPower 4GL Console Window...' print 'and the "attached" menu will minimize along with it!' menu$ ='%attached, OPEN, SHOW, PRINT, %heading "GUIDE_OPTIONS", NOSYSTEM, "MENU ON|OFF"' line input menu menu$ : ans$ end |
Separates DESCRIPTIVE items with "----". The separated line consists of the characters specified in a "text_str". If no text is given, the separated line defaults to a dashed line.
%BAR ['text_str']
|
| Example 8-40 %BAR menu directive |
|---|
menu$ = '"DATA ENTRY", "REPORTS", %bar"*", MAIL, EXIT'
line input menu menu$ : ans$
end
+---------------+
| DATA ENTRY |
| REPORTS |
| ********** |
| MAIL |
| EXIT |
+---------------+
|
The %COLUMNS directive sets the number of columns for the menu.
%COLUMNS number
|
| Example 8-41 %COLUMNS menu directive |
|---|
menu$ = '%columns 3,"DATA ENTRY","REPORTS",MAIL,HELP,EXIT'
line input menu menu$ : ans$
end
+-------------------------------------+
| DATA ENTRY | HELP | EXIT |
| REPORTS | MAIL | |
+-------------------------------------+
|
The %HEADING directive displays a blank line and a "text_str" between menu items. If no "text_str" is given, the line defaults to a dashed line.
%HEADING ['text_str']
|
| Example 8-42 %HEADING menu directive |
|---|
menu$ ='OPEN, SHOW, PRINT, %heading "GUIDE_OPTIONS", NOSYSTEM, "MENU ON|OFF"'
line input menu menu$ : ans$
end
+------------------+
| OPEN |
| SHOW |
| PRINT |
| |
| GUIDE_OPTIONS |
| NOSYSTEM |
| MENU ON|OFF |
+------------------+
|
The %ITEMS directive creates a multi-column menu. "Number" represents the number of items per column. %ITEMS creates as many columns as is necessary. Horizontally scroll the columns as needed.
%ITEMS number
|
| Example 8-43 %ITEMS menu directive |
|---|
menu$='ENGINES={%items 3, DBMS, ARS, ADABASE, RDB, DBASE}'
input menu menu$: ans$
end
+----------+------------------------+
| ENGINES | DBMS | RDB |
+----------| ARS | DBASE |
| ADABASE | |
+------------------------+
|
The %LOCKSTEP directive controls column scrolling when there are multiple columns in one menu. If it is turned OFF, the columns scroll independently. Otherwise, the columns scroll together.
%LOCKSTEP [ON|OFF]
|
| Example 8-44 %LOCKSTEP menu directive |
|---|
menu$ = '%lockstep off, %SIZE 4, 1, 2, 3, 4, 5, 6, %split, 7, 8, 9, 10, 11, 12'
line input menu menu$ : ans$
end
+---------------+
| ... | 7 |
| 4 | 8 |
| 5 | 9 |
| 6 | ... |
+---------------+
|
The %MENUBAR directive creates menu bars (menus with choices listed horizontally) with pull-down submenus.
%MENUBAR
|
| Example 8-45 %MENUBAR menu directive |
|---|
item1$='%menubar, OPEN, SELECT={INCLUDE,EXCLUDE}, SORT, PRINT'
line input menu item1$ : ans$
end
+---------------------------------------------------------------------------+
| OPEN SELECT SORT PRINT |
+----------+---SELECT---+---------------------------------------------------+
| INCLUDE |
| EXCLUDE |
+------------+
|
The %MESSAGE directive displays a message when the menu or submenu is displayed.
%MESSAGE 'message'
|
| Example 8-46 %MESSAGE menu directive |
|---|
menu$ = 'open, show, print, %message "Select a menu option"'
line input menu menu$: ans$
end
+----------+
| OPEN |
| SHOW |
| PRINT |
+----------+
Select a menu option
|
The %MULTI directive allows multiple items to be selected from a menu or submenu.
The %REPLACE directive can be located in any submenu. The calling menu is not kept on the screen. Pressing '\' will return to the calling menu.
The %SIZE number directive determines the number of DESCRIPTIVE items that are located in the menu_box.
There is no limit to the number of the items that can be used. If all of the items do not fit within the menu box, the items are vertically scrolled using the UP, DOWN, LEFT and RIGHT ARROW keys. "Str_var" contains the name of the selected item. If the %MULTI directive is used and the [Select] key is pressed, "Str_var" contains the names of the items. Each item is separated by a line feed character.
The %SPLIT directive instructs SheerPower to start a new column at that specified point in the menu.
%SPLIT
|
| Example 8-47 %SPLIT menu directive |
|---|
item1$='title, chapter, page={1201, 1202, 1203, 1204, %split, 1305, 1306, 1307}'
line input menu item1$ : ans$
end
+------------+
| TITLE |
| CHAPTER +-------PAGE---------+
| PAGE | 1201 | 1305 |
+----------| 1202 | 1306 |
| 1203 | 1307 |
| 1204 | |
+--------------------+
|
| Previous | Next | Contents | Index |