Progress
Language Tutorial
for Character


Changing Widget Characteristics Programming Example

This example changes the characteristics of a widget at different points in a procedure:

  1. Open lt-07-01.p and run it. The following display appears:
  2. The characteristics of the fill-in field widget in this example are either default characteristics or characteristics defined with the DEFINE VARIABLE statement.

  3. Choose the second button. The new display shows the same variable with a new set of characteristics established by the format phrase and frame phrase in a DEFINE FRAME statement.
  4. Choose the third button. This display shows the variable with another set of characteristics. A format phrase and frame phrase on a screen I/O statement (ENABLE) defined these characteristics.
  5. Now, pause your mouse pointer over the Exit button. Notice a small piece of text that displays. It is called a ToolTip. A ToolTip is a brief text piece that you can optionally define for any of the widgets that will be presented in this chapter. You’ll hear more about ToolTips throughout the chapter and see a few more examples of how to use them.

  6. Choose Exit and press SPACEBAR to return to the Procedure Editor.

Here is the code for this example:

lt-07-01.p
      /**********  DEFINE WIDGETS  **********/
/*1*/  DEFINE VARIABLE Var1 AS CHARACTER LABEL "Column Label" 
          INITIAL "Wonderful" FORMAT "x(3)" VIEW-AS FILL-IN.
      DEFINE BUTTON btn-one LABEL "DEFINE VARIABLE Options".
      DEFINE BUTTON btn-two LABEL "DEFINE FRAME Options".
      DEFINE BUTTON btn-three LABEL "Screen Output Options".
      DEFINE BUTTON btn-exit LABEL "Exit" TOOLTIP "This is a ToolTip".
      /**********  DEFINE FRAMES  **********/    
/*2*/  DEFINE FRAME Frame1 Var1 THREE-D.
/*3*/  DEFINE FRAME Frame2
          Var1 AT ROW 3 COLUMN 10 NO-LABELS FORMAT "x(6)" 
              VIEW-AS TEXT SKIP(2) 
          btn-one SKIP btn-two SKIP btn-three SKIP
          btn-exit WITH SIDE-LABELS THREE-D.   
      /********** MAIN LOGIC  **********/
      FRAME Frame1:HIDDEN = TRUE.
      FRAME Frame2:HIDDEN = TRUE.
      ENABLE Var1 SKIP(2) btn-one SKIP btn-two SKIP btn-three SKIP 
          btn-exit WITH FRAME Frame1.
      DISPLAY Var1 WITH FRAME Frame1.
      ENABLE ALL WITH FRAME Frame2.
      DISPLAY Var1 WITH FRAME Frame2.
/*4*/  ENABLE Var1 AT ROW 2 COLUMN 2 LABEL "Side Label" FORMAT "x(9)" 
          VIEW-AS EDITOR SIZE 12 BY 3 SKIP(2) btn-one SKIP btn-two SKIP 
          btn-three SKIP btn-exit WITH FRAME Frame3 SIDE-LABELS THREE-D.
      FRAME Frame3:HIDDEN = TRUE.
      DISPLAY Var1 WITH FRAME Frame3.
      VIEW FRAME Frame1.
/*5*/  /********** DEFINE TRIGGERS  **********/
      ON CHOOSE OF btn-one IN FRAME Frame1, btn-one IN FRAME Frame2,
          btn-one IN FRAME Frame3 DO:
              HIDE FRAME Frame2 FRAME Frame3.
              VIEW FRAME Frame1. END.
      ON CHOOSE OF btn-two IN FRAME Frame1, btn-two IN FRAME Frame2,
          btn-two IN FRAME Frame3 DO:
              HIDE FRAME Frame1 FRAME Frame3.
              VIEW FRAME Frame2. END.
      ON CHOOSE OF btn-three IN FRAME Frame1, btn-three IN FRAME Frame2,
          btn-three IN FRAME Frame3 DO:
              HIDE FRAME Frame1 FRAME Frame2.
              VIEW FRAME Frame3. END.
      /**********  WAIT-FOR  **********/
      WAIT-FOR CHOOSE OF btn-Exit IN FRAME Frame1, 
          btn-Exit IN FRAME Frame2, btn-Exit IN FRAME Frame3. 

NOTE: The THREE-D option is relevant only on a Windows client; it is ignored by a character client.

These notes explain the code highlights:

  1. The DEFINE VARIABLE statement establishes the default characteristics and the optional characteristics of the widget associated with the variable.
  2. This DEFINE FRAME statement changes no characteristics of the variable.
  3. This DEFINE FRAME statement alters the characteristics of the widget with both the format and frame phrases.
  4. This run-time screen I/O statement defines a new frame and alters the characteristics of the widget with both the format and frame phrases.
  5. Because Progress creates one of the frames used in this procedure at run time, the trigger definitions that reference that frame must follow the run-time frame definition.
NOTE: The TOOLTIP attribute noted in the code example is ignored when this code is run on a character client.


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