When you type a letter such as A in a field, it naturally appears in the field on the screen. This is called the default processing for the event. If there were a trigger ON "A" OF cFillTo, then you could APPLY that event to the fill-in field, the trigger would fire, and the letter would appear. This is the normal result of applying an event: both the default processing and any trigger on the event occur. However, some event-object pairs do not get ABL default processing using the APPLY statement. For example, applying the CHOOSE event programmatically to a button executes the trigger on that button but does not give focus to the button in the way that clicking it would.

As another twist to this relationship between events and their actions, consider the action on the object that initiates the event, not the one that receives it and does its default processing for the event. Sometimes you want only the trigger action on the target object to occur and not the default processing for the object that initiated the event. In this case, you can use the special RETURN NO-APPLY statement at the end of the trigger definition to suppress the default processing on the object that initiated it.

To suppress the default processing for an event in your test procedure:

  1. Add the RETURN NO-APPLY statement (along with the DO-END statements to turn the trigger into a block of code):
    DEFINE VARIABLE cFillFrom AS CHARACTER NO-UNDO.
    DEFINE VARIABLE cFillTo AS CHARACTER NO-UNDO.
    
    ENABLE cFillFrom cFillto WITH FRAME fFrame.
    
    ON ANY-PRINTABLE OF cFillFrom
    DO:
      APPLY LAST-KEY TO cFillto.
      RETURN NO-APPLY.
    END.
    
    
    WAIT-FOR CLOSE OF THIS-PROCEDURE.
  2. Run the procedure and type some text into cFillFrom:

    When you type, the keystrokes are applied to cFillTo, that is its default processing. But the RETURN NO-APPLY statement suppresses the default processing in cFillFrom, so it remains blank.

  3. Add this statement to the trigger:
    ON ANY-PRINTABLE OF cFillFrom
    DO:
      APPLY LAST-KEY TO cFillto.
      APPLY '*' TO cFillFrom.
    
      RETURN NO-APPLY.
    END.
  4. Run the procedure.You get asterisks in cFillFrom for each keystroke you type:

The trigger first applies the keystroke to the second fill-in, which causes the character to be displayed. It then applies the literal ‘*’ to the first fill-in, causing it to be displayed there. Finally, it does a RETURN NO-APPLY to suppress the display of the character you actually typed into the first fill-in. You could use this sort of code for a password field, for example.