Progress
Programming
Handbook


ENABLE/WAIT–FOR Processing

The ENDERROR key modifies its behavior yet again depending on whether input is blocked by a WAIT–FOR statement or any other input blocking statement, such as UPDATE. The p-error5.p procedure shows the difference:

p–error5.p
DEFINE VARIABLE a AS CHARACTER. 
DEFINE VARIABLE b AS CHARACTER. 
FORM a b WITH FRAME X 2 COLUMNS. 
SESSION:APPL-ALERT-BOXES = TRUE. 
ON END-ERROR ANYWHERE DO: 
  MESSAGE KEYFUNCTION(LASTKEY) "raised". 
END. 
MESSAGE "Entering UPDATE Block". 
DO ON ERROR UNDO, RETRY ON ENDKEY UNDO, LEAVE WITH FRAME X: 
  IF RETRY THEN MESSAGE "Retrying UPDATE Block". 
  UPDATE a WITH FRAME X. 
  MESSAGE "After UPDATE a". 
  UPDATE b WITH FRAME X. 
  MESSAGE "After UPDATE b". 
END. 
MESSAGE "Entering ENABLE/WAIT-FOR Block". 
DO ON ERROR UNDO, RETRY ON ENDKEY UNDO, LEAVE WITH FRAME X: 
  IF RETRY THEN MESSAGE "Retrying ENABLE/WAIT-FOR Block". 
  DISABLE ALL. 
  ENABLE a. 
  WAIT-FOR GO OF FRAME X. 
  MESSAGE "After ENABLE/WAIT-FOR a". 
  DISABLE ALL. 
  ENABLE b.  
  WAIT-FOR GO OF FRAME X. 
  MESSAGE "After ENABLE/WAIT-FOR b". 
END. 

Within the DO block of UPDATE statements, ENDERROR works as explained earlier. That is, for an UPDATE statement, ENDERROR on field a acts like ENDKEY (leaving the block) and on field b acts like ERROR (retrying the block and displaying the RETRY message).

However, in a similar DO block, where input is enabled with the ENABLE statement and blocked with the WAIT–FOR statement, ENDERROR always works like ENDKEY. It always leaves the block when entered for field a or field b. Progress treats ENDERROR differently in this case, because the WAIT–FOR statement is designed to control input in a more random and less modal fashion than the UPDATE statement. In an event-driven interface, the triggers for each widget are generally responsible for handling error input for that widget. Thus, ENDERROR as ENDKEY. provides a consistent way to exit the interface from any input widget.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095