MENU

 

Syntax:

       Then: MENU name label1,label2,...

 

Version Ref:  3.x

 

Description:

Puts up a menu that looks exactly like a standard filePro menu. It is composed of "name", an array defined with DIM.

 

There must be one more element in array "name" than choices on the menu. This extra element (the first element) holds the menu's title. All elements of array "name" are loaded in processing as in the following:

 

       name["1"]="The Menu's Title"

 

The first element of the array is always the menu’s title, as show above.

 

The actual menu choices, descriptions, and actions are loaded into this array based on their physical (p)osition on the displayed menu. The syntax for loading the rest of the elements of the menu array is as follows.

 

       name[p]="#:description"

 

       p is the position on the menu, must resolve to "1" through "24".

 

       # is the menu-choice character, can be 0-9, A-W,Y,Z, case-
       insensitive, or any punctuation mark on the keyboard.
       X is reserved by filePro as an exit key for the menu.)

 

       : is the mandatory separator between the choice
       character and the description

 

       description is the text for the menu choice

 

The label list directs processing after the user has selected a menu item. The label is where processing does an "implied" GOTO for each choice on the menu. Every menu choice is related to this label list by its numerical position on the menu plus "1". In other words, the choice in name["5"] is tied to the 4th label in this list. If the user selects this choice (even though it may have a menu choice-character of "S") processing will begin immediately at the fourth label in the list. This is because the menu heading is always held in name["1"], thereby offsetting the physical choices on the menu and the label list by "1".

 

NOTE: Once processing is sent to the appropriate label by consequence of the user picking a menu choice, it will continue as normal and will NOT automatically return to the MENU command. If you want this to happen, you must arrange it that way. In other words, if you want the user to always be returned to the menu after executing any menu choice, then you must specifically arrange things this way, usually by putting a GOTO back to the original MENU command at the end of each label's processing routine.

 

Description:

MENU lets you create menus on processing tables. Processing menus let you select particular processing operations in the same way that user menus let you select particular programs from a list of programs.

The MENU command uses the same routines and defaults as Define User Menus. You can have up to 12 choices in a single, centered column or up to 24 in two columns; the entries "X - Exit" and "Enter Selection > " are added automatically; and any character except X or x can be used as a menu choice.

 

Examples:

 

Domen    If:
       Then: dim tstmenu["4"]
         If:
       Then: tstmenu["1"]="Order Processing"
         If:
       Then: tstmenu["2"]="1:Get order status"
         If:
       Then: tstmenu["3"]="2:Update pickticket screen"
         If:
       Then: tstmenu["4"]="S:Change order status"
         If:
       Then: menu tstmenu status,scr4upd,fix
         If:
       Then: end '<=user presses "X" processing falls to this line
Status   If: 4 gt "1"
       Then: show "@The status of this order is OPEN" ; goto domen
         If: 4 le "1"
       Then: show "@The status of this order is CLOSED";goto domen
scr4upd  If:
       Then: screen 4 ; goto domen
Fix      If:
       Then: input q(1,yesno) "Is this order locked? (y/n) "
         If: q ne "Y"
       Then: 14="N" ; goto domen
         If:
       Then: 14="Y" ; goto domen

IMPORTANT: Multi-user versions. If you execute a MENU command from @when processing or regular INPUT processing, the record on which you are standing is locked. This means that others wishing to access this record either in Inquire, Update & Add (rclerk, dclerk) or with output processing (rreport, dreport) will not be able to do so. They will get a "Record is being updated, access denied" message. Therefore, use good judgment as to when to put up a processing menu and when to use another mechanism for providing choices and consequent actions. The MENU command can be used in @entsel processing, which does not lock the current record, if it will serve the desired purpose.

 

HINT: Processing menus can be made very dynamic by loading the menu array with varying text, perhaps based on user choices. The highlighted cursor can also be placed on desired menu choices from within processing by making use of the PUSHKEY command and arrow keys.