Kbase P9987: Function keys cannot be read into Progress when the input source is a file.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/20/2008 |
|
Status: Unverified
SYMPTOM(s):
The READKEY Progress 4GL function cannot read any special keys, such as function keys when the input source is a file.
CAUSE:
The READKEY is a DoubleByte enabled function, that means that it uses a 2-Byte buffer to handle user events. The function keys are read into Progress as escape sequences (ESC-15 for F5, for instance). In the case of the F5 key, this generates a double byte string containing 1B and 0F, which could be stored in a file. However, when the input comes from a file, the READKEY function is only able to read one byte at the time. Therefore, due to this restriction it is not possible to directly read the Fn function keys using the READKEY function.
FIX:
To accomplish this task, a parsing algorithm could be created to interpret the 1B0F as a control string and then apply the event associated with it. e.g.:
DEFINE VARIABLE viEscapeSequence AS INTEGER NO-UNDO.
DEFINE STREAM keyFromFile.
ON 'F5':U OF DEFAULT-WINDOW
DO:
MESSAGE "Fired!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
INPUT STREAM keyFromFile FROM VALUE("test.txt":U).
REPEAT:
READKEY STREAM keyFromFile.
IF viEscapeSequence = 27 AND LASTKEY = 15 THEN
APPLY 'F5':U TO DEFAULT-WINDOW.
viEscapeSequence = LASTKEY.
IF LASTKEY = -1 OR LASTKEY = -2 THEN
LEAVE.
END.
INPUT STREAM keyFromFile CLOSE.