Previous Topic: Control How Long a Panel is Displayed

Next Topic: Monitor Panel Return Codes

Analyze Panel Input

The &INKEY system variable returned to the NCL procedure following a synchronous &PANEL statement, is set to indicate how input was made (for example, by using the Enter key).

After a panel is displayed, Panel Services waits for either of the following conditions:

The &INKEY system variable can be tested to find out whether operator input has occurred, and to provide support for Function keys.

If the INWAIT time period elapses, &INKEY is set to a null value. If INWAIT did not expire, &INKEY is set to one of the strings in the following table:

Entry Type

&INKEY Value

Enter key

ENTER

Function key

F01 through F24 (always four characters)

PA key

PA1 through PA3

Light pen

ENTER

Note: If &CONTROL PFKMAP is in effect, F13 to F24 are presented as F01 to F12.

&INKEY can be tested like any other system variable, for example:

&IF &INKEY EQ PF01 &THEN &PANEL HELP

Remember that where INWAIT is used a null value can be set for &INKEY. Therefore, &IF statements using &INKEY must allow for a possible null value syntax error if &INKEY is eliminated from the statement by variable substitution. This allowance can be achieved as follows:

&IF  .&INKEY  EQ  .  &THEN &GOTO .NOINPUT

Alternatively, to determine if the INWAIT timer has expired, use return codes from Panel Services as requested by &CONTROL PANELRC. In this case, a return code of 12 is set in the &RETCODE system variable to indicate the INWAIT time interval has expired.

Note: For information about how to simplify testing individual function key values by using direct branching techniques, see the &GOTO verb in the Network Control Language Reference Guide.

Example: Panel Input

&CONTROL NOLABEL
.DISPLAY
         &PANEL MYMENU
         &GOTO .MENU&INKEY
         .
         .
         drops through if key not supported.
         .
         .
         &SYSMSG = &STR INVALID SELECTION
         &GOTO .DISPLAY
         .MENUENTER-* comes here if ENTER key pressed
         .
         .
         .MENUPF01-* comes here if F1 pressed
         .
         .
         .MENUPF02-* comes here if F2 pressed
         .
         .
         ....

The &GOTO .MENU&INKEY statement is resolved as an &GOTO to label constructed by the current value of &INKEY suffixed to .MENU. If the label is not found, the &GOTO acts as a null statement. Control passes to the next statement because the &CONTROL NOLABEL operand was used.

Note: &INKEY is a system variable, so any attempt to assign a value into &INKEY results in an error.