Pop menu handler |
Source |
S.WM |
CALL POPM USING
Window-id [Clear] |
Parameters |
Window-id |
The id of the window to be displayed as a pop-menu. |
Clear |
This parameter is optional and determines the clearing of the window on exit from the routine. If it is set to "Y" (or omitted) then the window is always cleared on exit. If set to "N" then the window is not cleared on a good exit. |
Copybooks |
None |
|
Other Requirements |
The window must contain only
one data item that is declared as a PIC X. |
Purpose |
The purpose of this routine is to allow speedbase to display a pop-menu of user selections (similar to a drop down menu in windows). It does this by interpreting a speedbase window that has been declared in a special format (See example). Options are selected from the pop-menu by either using the cursor up and down keys and selecting the required option with <CR>, or by pressing the single character option letter associated with the line (this selects the option without the need for the additional <CR>. The selection bar can be positioned on a default selection by moving the required option letter to the response field before calling this routine, if no default is set-up, the last option on the menu is highlighted (Usually X – Exit). If the menu has been left on screen (Clear = "N") and an invalid response has been selected, and you want to change the default selection letter, use a CALL CLHI- , this clears the current highlit line. No exceptions are returned. If you change the default without using this call, you can end up with two menu lines highlighted at the same time.N.B It is not necessary to call the TITLES routine (format window headings) before calling this routine. |
Exceptions |
|
|
|
Window did not contain any text |
|
Window did not contain a response field |
|
Window contained more than one response field |
|
Response field was not a PIC X field |
|
Window text lines defined in invalid sequence |
|
Screen image cannot be read |
|
Menu more than 50 characters wide |
|
No type-ahead buffer |
Example |
After generating the speedbase window using the <F9><Q> option in $SDE, you should remove the REPEAT UNTIL NXT line and the SEQUENCE EXIT, EXIT. You should then add the options POP-UP and SBOX. Note that the position of the response field is unimportant (as long as it is within the bounds of the menu) but is usually positioned on top of the selection letter of the last line. |
WINDOW DIVISION WINDOW MQ POP-UP SBOX BASE AT 13 60 02 02 "[ Queue Details ]" 04 03 "A - Arrivals" 05 03 "Q - Requests" 06 03 "R - Reservations" 07 03 "T - All Entries" 08 03 "X - Exit" 08 03 MQRESPONSE X ENDWINDOW PROCEDURE DIVISION MOVE "A" TO MQRESPONSE * Default required is `Arrivals’ CALL POPM USING MQ ON EXCEPTION * User keyed <Esc> OR MQRESPONSE = "X" EXIT END IF MQRESPONSE = "A" PERFORM ARRIVALS-SELECTED END |
The above window will look like the following, when displayed on the GUI. |
An additional technique used when displaying a pop-menu, is the ability to shade out an option that is not valid for selection. This is achieved by replacing the "-" character on the menu line with an "*". This is achieved by declaring a TXT data item at the position occupied by the "-" and either move a "-" or a "*" to the field before calling the routine (see following example). |
WINDOW DIVISION WINDOW MQ POP-UP SBOX BASE AT 13 60 02 02 "[ Queue Details ]" 04 03 "A - Arrivals" 05 03 "Q" 05 05 MQ-Q X TXT 05 07 "Requests" 06 03 "R - Reservations" 07 03 "T - All Entries" 08 03 "X - Exit" 08 03 MQRESPONSE X ENDWINDOW PROCEDURE DIVISION MOVE "-" TO MQ-Q * Assume option valid IF SCISPO NOT = "Y" * POP not installed MOVE "*" TO MQ-Q * Remove option as not valid for selection END CALL POPM USING MQ ON EXCEPTION OR MQRESPONSE = "X" EXIT END IF MQRESPONSE = "A" PERFORM ARRIVALS-SELECTED END IF MQRESPONSE = "Q" IF MQ-Q = "*" ERROR "Global 3000 POP not installed, cannot select" ELSE PERFORM REQUESTS-SELECTED END END |
The above window will look like the following, when displayed on the GUI. |
Global 3000 Example |
This routine is used throughout the applications |