SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

8.18.1 Items

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.

8.18.1.1 Descriptions

Menu descriptions are displayed on the menu for the user to choose.

8.18.1.2 Data Value

The data value is the value returned to the application when the menu item is chosen.

8.18.2 Submenu Indicator

A submenu indicator consists of a "{" followed by menu elements followed by "}".

8.18.3 Menu Directives

The following directives can be used with the [LINE] INPUT MENU statement:

%AT row, column

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 

%ATTACHED

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.

FORMAT:


        %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

%BAR

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.

FORMAT:


        %BAR ['text_str'] 

EXAMPLE:

Example 8-40 %BAR menu directive

  menu$ = '"DATA ENTRY", "REPORTS", %bar"*", MAIL, EXIT' 
  line input menu menu$ : ans$ 
  end
 
        
 
        +---------------+ 
        |  DATA ENTRY   | 
        |  REPORTS      | 
        |  **********   | 
        |  MAIL         | 
        |  EXIT         | 
        +---------------+ 

%COLUMNS

The %COLUMNS directive sets the number of columns for the menu.

FORMAT:


        %COLUMNS number 

EXAMPLE:

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   |          | 
        +-------------------------------------+ 

%HEADING

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.

FORMAT:


        %HEADING ['text_str'] 

EXAMPLE:

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     | 
        +------------------+ 

%ITEMS

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.

FORMAT:


        %ITEMS number 

EXAMPLE:

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   |           | 
                   +------------------------+ 

%LOCKSTEP

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.

FORMAT:


        %LOCKSTEP [ON|OFF] 

EXAMPLE:

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   |   ...  | 
        +---------------+ 

%MENUBAR

The %MENUBAR directive creates menu bars (menus with choices listed horizontally) with pull-down submenus.

FORMAT:


        %MENUBAR 

EXAMPLE:

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   | 
                   +------------+ 

%MESSAGE

The %MESSAGE directive displays a message when the menu or submenu is displayed.

FORMAT:


        %MESSAGE 'message' 

EXAMPLE:

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

%MULTI

The %MULTI directive allows multiple items to be selected from a menu or submenu.

%REPLACE

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.

%SIZE number

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.

%SPLIT

The %SPLIT directive instructs SheerPower to start a new column at that specified point in the menu.

FORMAT:


        %SPLIT 

EXAMPLE:

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