Evaluates an integer expression (such as 301) and returns a character string that is the function of the key associated with that integer expression (such as GO).
KEYFUNCTION ( expression )This procedure displays a menu and highlights different selections, depending on which key you press. On the first iteration of the REPEAT block, the COLOR statement tells the AVM to color msg[ix] with the same color used to display messages. Because the initial value of ix is 1, msg[ix] is the first menu selection. Therefore, the first menu selection is colored MESSAGES.
DEFINE VARIABLE msg AS CHARACTER NO-UNDO EXTENT 3.DEFINE VARIABLE ix AS INTEGER NO-UNDO INITIAL 1.DEFINE VARIABLE newi AS INTEGER NO-UNDO INITIAL 1.DEFINE VARIABLE func AS CHARACTER NO-UNDO.DISPLAY" Please choose " SKIP(1)" 1 Run order entry " @ msg[1] ATTR-SPACE SKIP" 2 Run receivables " @ msg[2] ATTR-SPACE SKIP" 3 Exit " @ msg[3] ATTR-SPACE SKIPWITH CENTERED FRAME menu NO-LABELS.REPEAT:COLOR DISPLAY MESSAGES msg[ix] WITH FRAME menu.READKEY.func = KEYFUNCTION(LASTKEY).IF func = "CURSOR-DOWN" AND ix < 3 THENnewi = ix + 1.ELSE IF func = "CURSOR-UP" AND ix > 1 THENnewi = ix - 1.ELSE IF func = "GO" OR func = "RETURN" THEN LEAVE.IF ix <> newi THENCOLOR DISPLAY NORMAL msg[ix] WITH FRAME menu.ix = newi.END.See the example in the KEYCODE function reference entry for details on what happens if you press keylabel component.
![]()
The value returned by the KEYFUNCTION function is affected by any ON statements you use to redefine the value of the key represented by expression.
![]()
If the key represented by expression has no function currently assigned to it or if it has the function of BELL, KEYFUNCTION returns a null value.
© 2012 Progress Software Corporation and/or its subsidiaries or affiliates. |