Progress
Language Tutorial
for Windows


Fill-in Field Events

When an enabled fill-in field appears on screen, it can accept a whole range of events. The fill-in’s default response to most events will be exactly what you intend, requiring no programming on your part. The fill-in field:

ENTRY and LEAVE Event Functions

The ENTRY and LEAVE event functions are useful for attaching functionality to the widget. ENTRY executes when a widget receives input focus, while LEAVE executes when input focus moves from a widget. Use ENTRY when you need to do something before the user manipulates the widget. For example, you might want to issue a cautionary message to the user. Use LEAVE when you want to manipulate the widget after the user finishes with it. For example, you might want to update other widgets in the display based upon the new input.

Follow these steps to use ENTRY and LEAVE:

  1. Open lt-07-04.p and run it. The following display appears:
  2. Press TAB. Notice the message that appears in the message area. A trigger attached to ENTRY displays this message.
  3. Press TAB again. Another message appears: “Hey, where’s the tip!” A trigger attached to LEAVE displays this message.
  4. Choose Exit, then press SPACEBAR to return to the Procedure Editor.

Here is the code that created this interface:

lt-07-04.p
      /**********  DEFINE WIDGETS  **********/
      DEFINE VARIABLE Field1 AS CHARACTER INITIAL "Home"
          FORMAT "x(10)" LABEL "Start".
      DEFINE VARIABLE Field2 AS CHARACTER INITIAL "Joe’s Deli" 
         FORMAT "x(10)" LABEL "Destination".
      DEFINE BUTTON btn-Exit LABEL "Exit". 
      /**********  DEFINE FRAMES  **********/
      DEFINE FRAME Frame1
          SKIP(2) Field1 SPACE (10) Field2 SKIP(2)
          btn-Exit
             WITH NO-BOX CENTERED SIDE-LABELS THREE-D. 
      /**********  DEFINE TRIGGERS  **********/
/*1*/  ON ENTRY OF Field2 
       DO:
          MESSAGE "Can I take your order, please?".
       END.
/*2*/  ON LEAVE OF Field2
       DO:
          MESSAGE "Hey, where’s the tip!".
       END. 
      /***********  MAIN LOGIC  **********/
      DISPLAY Field1 Field2 WITH FRAME Frame1.
      ENABLE ALL WITH FRAME Frame1.
      WAIT-FOR CHOOSE OF btn-Exit. 

As you can see at points 1 and 2, simple triggers on ENTRY and LEAVE are all that you need to extend the functionality of the widget.

NOTE: LEAVE does not execute when you switch focus between windows or on high-level event functions, such as GO or menu mnemonics.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095