Progress
Language Tutorial
for Windows


Radio Set Programming Example

Follow these steps to demonstrate radio sets:

  1. Open lt-07-06.p and run it. The following display appears:
  2. Press TAB to move through the widgets.
  3. Use the arrow keys to move among radio buttons.
  4. If you pause the mouse pointer over either set of radio buttons, an appropriate ToolTip text message is displayed.

  5. Press RETURN or SPACEBAR or click to choose a radio button. Note that the Product Code field updates after each selection.
  6. Choose Exit, then press SPACEBAR to return to the Procedure Editor.

Here is the code that created the display. This code also shows how to set up the radio sets:

lt-07-06.p
      /**********  DEFINE WIDGETS  **********/
/*1*/  DEFINE VARIABLE Pickup AS INTEGER INITIAL 1 VIEW-AS RADIO-SET
          HORIZONTAL RADIO-BUTTONS "Quarter Ton", 1, "Half Ton", 2, 
          "One Ton", 3, "Two Ton", 4 TOOLTIP "Select one Pickup.". .
      DEFINE VARIABLE Engine AS INTEGER INITIAL 1 VIEW-AS RADIO-SET
          HORIZONTAL RADIO-BUTTONS "4 Cylinder", 1, "6 Cylinder", 2, 
          "8 Cylinder", 3 TOOLTIP "Select one Engine.".
/*2*/  DEFINE VARIABLE P-code AS CHARACTER 
          LABEL "Product Code" INITIAL "11".
      DEFINE BUTTON btn-Exit LABEL "Exit".

      /**********  DEFINE FRAMES  **********/
      DEFINE FRAME Frame1
          SKIP(1) 
          Pickup SKIP
          Engine SKIP
          P-code SKIP(1)
          btn-Exit
              WITH SIDE-LABELS CENTERED ROW 2 THREE-D.

      /**********  DEFINE TRIGGERS  **********/
/*3*/  ON VALUE-CHANGED OF Pickup, Engine
       DO:
          ASSIGN Pickup
                 Engine
               P-code = STRING(Pickup) + STRING(Engine).
         DISPLAY Product-code WITH FRAME Frame1.
       END.

      /**********  MAIN LOGIC  **********/
      DISPLAY Pickup Engine P-code WITH FRAME Frame1.
      ENABLE ALL WITH FRAME Frame1.
      WAIT-FOR CHOOSE OF btn-Exit. 

These notes help explain the code:

  1. For each label-value pair, Progress creates a radio button. In this case, the screen labels describe a product and the values represent an internal code. A radio set has vertical orientation by default. The keyword HORIZONTAL in the VIEW-AS phrase changes the orientation.
  2. The INITIAL option sets the value of the P-code variable to "11".
  3. Whenever you select a different radio button, the VALUE-CHANGED event executes and Progress concatenates and reassigns the values of the radio-set variables to P-code.
NOTE: The ToolTip attribute noted in the code is ignored when this code is run on a character client.

Practice Problems

You’ve now added two more widgets to your repertoire. Use the problem below to practice what you’ve learned about the widgets.

Problem 7-2: lt-07-s2.p

Duplicate this display using variables as the basis for the widgets. Use a VALUE-CHANGED trigger to update the Package Code field. The first three digits come from the index of the radio sets. The last three digits are "1" if the corresponding toggle box is TRUE and "0" if it is FALSE. (HINT: Use the online help system to look up the IF... THEN... ELSE function.)


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