Consultor Eletrônico



Kbase P45012: 4GL/ABL: How to detect the time-out of a WAIT-FOR with a PAUSE option?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/23/2009
Status: Verified

GOAL:

4GL/ABL: How to detect the time-out of a WAIT-FOR with a PAUSE option?

GOAL:

How to check for the time-out of a WAIT-FOR with a PAUSE option?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

The PAUSE n option of the WAIT-FOR statement, as well as the PAUSE n statement itself, waits up to n seconds for a keystroke. If no keystroke occurred during that time, the PAUSE n option sets the value in LASTKEY to -1.
Therefore, to check the time-out of a WAIT-FOR with a PAUSE statement, simply check whether LAST-EVENT:CODE is equal to -1. The following code demonstrates this by messaging the value of -1 after one second passes without any keys being pressed.
VIEW DEFAULT-WINDOW.
WAIT-FOR F1 OF DEFAULT-WINDOW PAUSE 1.
MESSAGE LAST-EVENT:CODE
VIEW-AS ALERT-BOX INFO BUTTONS OK.