UFUN

Detect Function keys in display mode

Source

 

CALL UFUN USING Window-id Routine [Direction]

Parameters

Window-id

The two-character id of a window to be entered.

Routine

The section to be called when either UF1, UF2 or UF3 is keyed.

Direction

This optional third parameter is a variable or literal containing the value "B" if the window needs to be displayed in reverse order (See BACK routine)

Copybooks

None

 

Other Requirements

The call to UFUN must be done from the procedure division. It must not be invoked from within a speedbase window.

Purpose

This routine is used to enable the processing of the UF1, UF2 and UF3 keys from within a display window. When the pressing of a function key is detected, the section name passed as a parameter is invoked. Upon exit from this section control is returned to the window. The number of the function key pressed is held in the accumulator, upon entry to the passed section. The first line of code should be a $STORE variable. This variable can then be checked to determine which function was pressed.

Exceptions

Standard window exception codes.

Example

An enquiry program has the following windows declared.

W1	Order header window.
W2	Header details window.
W3	Order Detail Lines.
W4	Order Comment lines.
77	Z-FKEY	PIC 9 C

PROCEDURE DIVISION
*
* Baseline message `Header Details – F1, Lines – F2, Comments – F3’
*
DISPLAY "Header Details – "
DISPLAY $FNTX($F-UF1) SAMELINE	        * Text of f1 keytop
DISPLAY ", Lines - " SAMELINE
DISPLAY $FNTX($F-UF2) SAMELINE	        * Text of f2 keytop
DISPLAY ", Comments – " SAMELINE
DISPLAY $FNTX($F-UF3) SAMELINE	        * Text of f3 keytop
CALL DNTCLR				* Keep baseline message visible

CALL UFUN USING W1 E00-ENQUIRY
ON EXCEPTION EXIT			* User <Esc> from window
EXIT

SECTION E00-ENQUIRY
    $STORE Z-FKEY		* Function key pressed (1,2 or 3)
    IF Z-FKEY = 1		* User pressed F1 so display
       ENTER WINDOW W2		* the Order header details enquiry
       ON EXCEPTION		* window.
       END
    END

    IF Z-FKEY = 2		* User pressed F2 so display
       ENTER WINDOW W3		* the Order details enquiry
       ON EXCEPTION		* window.
       END
    END

    IF Z-FKEY = 3		* User pressed F3 so display
       ENTER WINDOW W4		* the Comment Lines enquiry
       ON EXCEPTION		* window.
       END
    END
EXIT				* Return to order header window.

Global 3000 Example

This routine is used in PM420C (Purchase Order Enquiry) to allow different enquiry windows to be selected via the F1, F2 and F3 function keys.


 © 1998 TIS Software Ltd
Last updated 14-Aug-98 by
David Featley (djf)