PreviousNextIndex

ON ENDKEY phrase

Describes the processing that occurs when the ENDKEY condition occurs during a block. This condition usually occurs when the user presses END-ERROR during the first interaction of a block iteration, or any time the user presses a defined END-KEY.

If you use a REPEAT or FOR EACH block, the default processing for ENDKEY is to undo all the processing in the current iteration of the block, then leave the block and continue on to any remaining statements in the routine.

Note: Does not apply to SpeedScript programming.
Syntax

ON ENDKEY UNDO 
  [ label1 ] 
  [     , LEAVE [ label2 ] 
     |  , NEXT [ label2 ] 
     |  , RETRY [ label1 ] 
     |  , RETURN [ return-value | 
                  ERROR [ return-value | error-object-expression ] | 
                  NO-APPLY ] 

label1
LEAVE [ label2 ]
NEXT [ label2 ]
RETRY [ label1 ]
RETURN ...
Example

In this procedure, if the user presses END-ERROR or END-KEY while changing the CreditLimit field, any changes made during the current iteration of the block are undone, and the same iteration is run again. If this procedure did not use the ON ENDKEY phrase and the user pressed END-ERROR, the procedure ends because the default ENDKEY action is UNDO, LEAVE. After leaving the FOR EACH block, the procedure ends because there are no more statements.

r-endky.p
ON WINDOW-CLOSE OF CURRENT-WINDOW 
  STOP. 
FOR EACH Customer ON ENDKEY UNDO, RETRY: 
  DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit. 
  SET Customer.CreditLimit  
    VALIDATE(Customer.CreditLimit > 0,"non-zero credit limit"). 
END. 

See also

ON ERROR phrase, ON QUIT phrase, ON STOP phrase, RETURN statement, RETURN-VALUE function, UNDO statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex