Kbase P187352: How to apply INSERT-MODE to an UPDATE field programmatically
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/16/2011 |
|
Status: Unverified
GOAL:
How to apply INSERT-MODE to an UPDATE field programmatically
GOAL:
How to place the user in input mode in an UPDATE statement without pressing INSERT, F9 or CTRL-T
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Product Family
FIX:
Apply INSERT-MODE in an editing block on the UPDATE statement. Use a logical variable to indicate whether INSERT-MODE has already been applied; otherwise the APPLY statement will toggle INSERT-MODE on and off with each keystroke.
The following example uses the UPDATE statement to allow a user to enter an email address into a variable. If the previous entry was an email address as indicated by the presence of the "@" symbol in the input, the domain is retained in the variable and the user is placed in insert mode to enter the next email address without having to retype the domain.
DEFINE VARIABLE cMayBeEmail AS CHARACTER NO-UNDO FORMAT 'X(40)'.
DEFINE VARIABLE iAtPosition AS INTEGER NO-UNDO.
DEFINE VARIABLE lOverwrite AS LOGICAL NO-UNDO.
UPDATE cMayBeEmail.
MESSAGE cMayBeEmail.
iAtPosition = INDEX(cMayBeEmail, '@').
IF iAtPosition > 0 THEN
DO:
cMayBeEmail = SUBSTRING(cMayBeEmail, iAtPosition).
lOverwrite = YES.
ON ENTER OF cMayBeEmail DO:
IF lOverwrite THEN
APPLY 'INSERT-MODE'.
lOverwrite = NO.
APPLY LASTKEY.
END.
UPDATE cMayBeEmail.
MESSAGE cMayBeEmail.
END.