Progress
Language Tutorial
for Windows


Editor Programming Example

Follow these steps for a demonstration of an editor widget:

  1. Open lt-07-10.p and run it. The display shown below appears:
  2. Select the editor widget. The text cursor appears in the widget.
  3. Type some comments. Notice the word-wrap behavior.
  4. Press RETURN to enter a manual line break.
  5. Choose Exit, then press SPACEBAR to return to the Procedure Editor.

This is the code that created the display:

lt-07-10.p
      /**********  DEFINE WIDGETS  **********/
      DEFINE VARIABLE Catalog AS Logical LABEL "Product Catalog"
          VIEW-AS TOGGLE-BOX.
      DEFINE VARIABLE Price AS Logical LABEL "Price List"
          VIEW-AS TOGGLE-BOX.
      DEFINE VARIABLE Credit AS Logical LABEL "Credit Application"
          VIEW-AS TOGGLE-BOX.
      DEFINE VARIABLE Mail AS Logical LABEL "Put on Mailing List?"
          VIEW-AS TOGGLE-BOX.
/*1*/  DEFINE VARIABLE Comments AS CHARACTER LABEL "Comments"
          VIEW-AS EDITOR INNER-CHARS 25 INNER-LINES 6.
      DEFINE BUTTON btn-Exit LABEL "Exit". 
      /**********  DEFINE FRAMES  **********/
      DEFINE FRAME Questions
          "Customer wants our:" AT ROW 2 COLUMN 2
           Catalog   AT ROW 3 COLUMN 2
           Price     AT ROW 4 COLUMN 2
           Credit    AT ROW 5 COLUMN 2
           Mail      AT ROW 7 COLUMN 2
           btn-Exit  AT ROW 9 COLUMN 2
           Comments  AT ROW 2 COLUMN 30
              WITH SIDE-LABELS CENTERED TITLE "Customer Questionnaire"
                   THREE-D. 
      /**********  MAIN LOGIC  **********/
      DISPLAY Catalog Price Credit Mail Comments WITH FRAME Questions.
      ENABLE ALL WITH FRAME Questions.
      WAIT-FOR CHOOSE OF btn-Exit.   

Simply by defining the size with the INNER-CHARS and INNER-LINES options at point 1, Progress creates an editor with the text-handling behavior the user expects.

NOTE: Keep in mind that ToolTip information can be added to an editor widget. Refer to the code examples in either the Toggle Box Programming Example or the Radio Set Programming Example presented earlier in this chapter that show how to define the TOOLTIP option.

Practice Problems

The problem below gives you some practice with sliders, selection lists, combo boxes, and editors.

Problem 7-3: lt-07-s3.p

It seems that All Around Sports needs to add another display to its on-line questionnaire application. It needs widgets to record customer responses to these questions.

A. What percentage of your business is in sports equipment?

B. What percentage of your business is in sports supplies?

C. What percentage of your business is in sports apparel?

D. Of the following categories, which best describes your business?

Department store, general sports retailer, specialty sports retailer, secondary distributor, mail order distributor, sports club

E. What is your best sales season of the year?

F. Do you have any suggestions for All Around Sports?

Create the display All Around Sports needs, using these directions.

  1. Use sliders to implement questions A, B, and C.
  2. Use a selection list to implement question D.
  3. Use a combo box to implement question E.
  4. Use an editor capable of holding 25 lines of 60 characters to implement question F. However, make the editor 
    small enough to fit in the same display as the other widgets. 
    


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