Progress
Language Tutorial
for Windows


Working with Text Widgets

The text widget is very similar to the fill-in field. You use a text widget when you want to display values as text strings, but do not want the user to change the data. In other words, text widgets are display-only fields.Figure 7–3 shows the parts of a text widget.

Figure 7–3: Parts of a Text Widget

The text widget has these advantages:

This is the syntax for specifying a text widget.

SYNTAX
VIEW-AS TEXT [ TOOLTIP tooltip ] 

Converting Fill-in Fields with the USE-TEXT Option

When you design a frame for data entry, but then decide to use the same frame for display only, you have to place a VIEW-AS TEXT phrase on every fill-in field in the frame to make the fields static (display only). Progress includes the USE-TEXT frame phrase option to make this conversion easy. Specifying USE-TEXT in a frame phrase converts the fill-in fields in the frame to text widgets.

The following code example shows this technique:

DEFINE FRAME Frame1
    Field1 SKIP
    Field2 SKIP
    Button1 Button2
        WITH SIDE-LABELS THREE-D.
        .
        .
        .
DISPLAY Field1 Field2 WITH FRAME Frame1 USE-TEXT. 

The USE-TEXT option on the screen I/O statement converts the fill-in fields in the frame to text widgets. The USE-TEXT option does not affect any other type of widget.

Static Text without Variables

To include text as part of a frame without first storing the text in a variable, simply place the text between quotes in a DEFINE FRAME or screen I/O statement. Progress creates a text widget to contain the string. You can then apply the options of the format phrase to the constant as this code example shows:

DEFINE FRAME Frame1
    Field1 SKIP
    "Constant Text String" TO 50
    Button1 Button2
        WITH SIDE-LABELS THREE-D.
        .
        .
        .
DISPLAY Field1 "More Text" AT ROW 9 COLUMN 30 WITH FRAME Frame1. 

Practice Problems

You’ve covered quite a bit of new material so far in this chapter. It’s time to cement your new knowledge in place by putting it to use.

Problem 7-1: lt-07-s1.p

Create a procedure that accepts input for the List Price, Discount, and Tax Rate with fill-in fields. Using a LEAVE trigger on the Tax Rate field, calculate the adjusted Price, Tax, and Total with text widgets.


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