PreviousNextIndex

EDITING phrase

Identifies the process that follows each keystroke during a PROMPT-FOR, SET, or UPDATE statement.

This phrase is maintained primarily for compatibility with Progress Version 6 or earlier.

Note: Does not apply to SpeedScript programming.
Syntax

[ label: ] EDITING: statement ... END 

statement
Example

This procedure lets you update the ix variable, and immediately processes each of your keystrokes. The READKEY statement reads each of the keys you press. The APPLY statement applies, or executes, each keystroke. This is a very simple EDITING phrase and is the same as entering UPDATE ix.

r-edit.p
DEFINE VARIABLE ix AS INTEGER NO-UNDO. 
UPDATE ix EDITING: 
  READKEY. 
  APPLY LASTKEY. 
END. 

The following r-edit2.p procedure uses an EDITING phrase with an UPDATE statement to control what happens based on each keystroke during the UPDATE. Here, the user can press any key while updating any field except SalesRep.

While in the SalesRep field, the user can press SPACEBAR to scroll through the possible values for the SalesRep field. If the user presses the TAB, BACKTAB, GO, RETURN, or END-ERROR key, the procedure executes that key. If the user presses any other key while in the SalesRep field, the terminal beeps.

r-edit2.p
PROMPT-FOR Customer.CustNum. 
FIND Customer USING Customer.CustNum. 
/* Update Customer fields, monitoring each keystroke during the UPDATE */ 
UPDATE Customer.Name Customer.Address Customer.City Customer.State SKIP 
  Customer.SalesRep HELP "Use the space bar to select a SalesRep"  
  WITH 2 COLUMNS EDITING:  /* Read a keystroke */ 
  READKEY. 
  /* If the cursor is in any field except SalesRep, execute the last key 
     pressed and go on to the next iteration of this EDITING phrase to check 
     the next key */ 
  IF FRAME-FIELD <> "SalesRep" THEN DO: 
    APPLY LASTKEY. 
    IF GO-PENDING THEN LEAVE. 
    ELSE NEXT. 
  END. 
  /* When in the SalesRep field, if the last key pressed was the space bar 
     then cycle through the sales reps */ 
  IF LASTKEY = KEYCODE(" ") THEN DO: 
    FIND NEXT SalesRep NO-ERROR. 
    IF NOT AVAILABLE SalesRep THEN FIND FIRST SalesRep. 
    DISPLAY SalesRep.SalesRep @ Customer.SalesRep. 
    NEXT. 
  END. 
  /* If the user presses any one of a set of keys while in the SalesRep field, 
     immediately execute that key */ 
  IF LOOKUP(KEYFUNCTION(LASTKEY),  
    "TAB,BACK-TAB,GO,RETURN,END-ERROR") > 0 THEN APPLY LASTKEY. 
  ELSE BELL. 
END. 

Notes
See also

END statement, PROMPT-FOR statement, READKEY statement, SET statement, UPDATE statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex