Progress
Language Tutorial
for Character


Using the Format Phrase

Throughout the tutorial, you’ve seen the appearance of widgets affected by programming options included in a DEFINE FRAME statement or on a screen I/O statement. These options are part of a Progress language structure called the format phrase. Not to be confused with the FORMAT option, the format phrase is a collection of options that you can specify after a field, variable, or expression reference in a DEFINE FRAME statement or screen I/O statement.

This simplified syntax for the DEFINE FRAME statement shows how the format phrase fits into the definition of a frame.

SYNTAX
DEFINE FRAME frame-name
  [ frame-item [ format-phrase ] ] ...
  format-phrase 

A frame item can be a constant, a database field, or a variable. After each, you can specify one or more options from the format phrase to affect, for example, the label, format, or position of the frame item. The partial syntax below shows the most frequently used options of the format phrase.

SYNTAX
[ at-phrase | COLON n | TO n ]
[ LABEL string | NO-LABELS]
[ COLUMN-LABEL string ]
[ FORMAT string ]
[ HELP string ]
[ view-as-phrase ]
[ VALIDATE ( condition , msg-expression ) ] 

These options all help you design attractive and intuitive displays. Table 7–2 describes the options.

Table 7–2: Format Phrase Options 
Option
Use
Example
at-phrase
Specifies the row and column position for the top left corner of the widget.
field1 AT ROW 2 COLUMN 40 
COLON n
Specifies the column position of the colon in the widget’s label.
field1 COLON 40 
TO n
Specifies the column position of the right edge of the widget.
field1 TO 40 
LABEL string
Specifies a display label for the widget.
field1 LABEL "Display Label" 
NO-LABELS
Suppresses all display labels for the widget.
field1 NO-LABELS 
COLUMN-LABEL string
Specifies the display label to use when the frame is in column label mode.
field1 COLUMN-LABEL "Top 
Label" 
FORMAT string
Specifies a format for the data of the widget.
field1 FORMAT "x(12)" 
HELP string
Specifies a message to display in the message area of the window when the widget has input focus.
field1 HELP "Enter an even 
number." 
view-as-phrase
Specifies the data widget for a field or variable.
field1 VIEW-AS FILL-IN 
VALIDATE (condition,
msg-expression)
Verifies that input matches the supplied condition. If so, Progress allows the input. Otherwise, Progress displays the message expression in an alert box.
field1 VALIDATE(field1 > 0, 
"Must be greater than zero") 

You can specify one or many format phrase options after each field, variable, or constant at these points:

  1. DEFINE FRAME statement
  2. Screen I/O statement

Also, you can specify format phrase options for an expression in a screen I/O statement, but not in a DEFINE FRAME statement. Note the following code example:

DISPLAY (A + B) LABEL "Sum of A and B" WITH FRAME Frame1. 

Note that the LABEL, COLUMN-LABEL, FORMAT, and VIEW-AS phrase options are also available on the DEFINE VARIABLE statement.


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