If you want to test the screen-value within the trigger, try a variation of the below in the ANY-PRINTABLE trigger.
AN ANY-PRINTABLE OF ..... DO:
DEF VAR cBefore AS CHAR NO-UNDO.
DEF VAR cAfter AS CHAR NO-UNDO.
ASSIGN cBefore = SELF:SCREEN-VALUE. /* Value prior to keystroke */
APPLY LASTKEY. /* bring up to date */
ASSIGN cAfter = SELF:SCREEN-VALUE. /* Value after keystroke */
IF cAfter EQ "A naughty word" THEN
ASSIGN SELF:SCREEN-VALUE = cBefore. /* Reset to previous */
/* other tests if needed */
RETURN NO-APPLY. /* because we already applied lastkey */
END.
FIND FIRST Program WHERE Program.ProgramName BEGINS SELF:SCREEN-VALUE NO-LOCK NO-ERROR.
IF AVAILABLE Program THEN
DO:
REPOSITION br-program TO RECID RECID(Program) NO-ERROR.
END.
/* Now don't write/apply the key */
END.
If I write "APPLY LASTKEY" progress apply's the key two times. At the beginning and at the end of the trigger.
The only solution I know is to delete the char with "SUBSTRING"!
Is there no easier way?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.