Kbase P144348: 4GL/ABL: Can user interaction with the MESSAGE statement via the SET, UPDATE or PAUSE be captured by
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  09/04/2009 |
|
Status: Unverified
GOAL:
4GL/ABL: Can user interaction with the MESSAGE statement via the SET, UPDATE or PAUSE be captured by the LASTKEY function?
GOAL:
Why does the LASTKEY function fail to capture the key code of the user input in response to the MESSAGE statement prompt?
GOAL:
When a user strikes a key or clicks a mouse, why does the LASTKEY function not capture the key code of the user interaction with the MESSAGE statement?
GOAL:
Why does the LASTKEY function return -1 and not the KEYCODE of the key entered by the user. That is the KEYCODE of "Y" or the KEYCODE of "N" when the following code is executed?
MESSAGE
"Type Y or N to continue."
VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO
UPDATE choice AS LOGICAL.
MESSAGE LASTKEY VIEW-AS ALERT-BOX.
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
OpenEdge 10.2x
FIX:
No, the user input resulting from the prompt of the MESSAGE statement via the SET, UPDATE or PAUSE options can not be captured by the LASTKEY function because selecting one of the buttons in an alert box, even when using the keyboard to do so, does not generate any 4GL/ABL events.
And since the LASTKEY function returns the integer key code of the most recent event read from the user (that is, from the keyboard or mouse) during an interaction with a procedure. It follows that LASTKEY can not process user input resulting from the prompt of the MESSAGE statement via the SET, UPDATE or PAUSE options because these user interactions do not raise any 4GL/ABL events.
Warning: Be aware that when the MESSAGE statement is placed within the main program logic, the "current" LASTKEY value passes through the MESSAGE statement unchanged. And that the value of the LASTKEY function is -1 on the entry of the Procedure Editor, the start of the 4GL/ABL session, the timeout of a READKEY statement or the timeout of a PAUSE statement. Hence the value of the LASTKEY function being -1 should not be tested for as the normal result of the MESSAGE statement.