Progress
Programming
Handbook
FORM and DEFINE FRAME Statements
Often, you want to describe characteristics of a frame but do not want to include that description in the Frame phrase of a data-handling statement. This is especially true if the frame characteristics are very complex. You can use the FORM or DEFINE FRAME statements to describe the layout and processing properties of a certain frame. Specifically, you use these statements to:
The FORM and DEFINE FRAME statements only describe the layout of a frame. They do not actually bring the frame into view. To see the frame, you must use either a data-handling statement that uses that frame or the VIEW statement, or set the frame VISIBLE attribute to TRUE.
The location of the FORM statement affects the scope of your frame, so you must place any FORM statements you use within the appropriate block or blocks of a procedure.
Normally, the first reference to a frame scopes the frame to the current block. However, the DEFINE FRAME statement does not scope the frame. The FORM statement, like data handling statements, does scope the frame. For more information on these statements, see the Progress Language Reference .
Laying Out Frame Fields
When you are using a frame that has a very complex layout or when you want to use the same frame layout many times in a single procedure, you can use the FORM or DEFINE FRAME statements to describe the frame. That way, the frame description is in only one place, not scattered throughout the procedure.
In the following procedure, the DEFINE FRAME statement describes the layout of frame a. By default, Progress displays the fields in the order they appear in the DEFINE FRAME statement. You can use the AT phrase to explicitly position a field. When you run the procedure and update the fields, you move through them in the order they appear in the UPDATE statement. That is, the order of the fields in the DEFINE FRAME (or FORM) statement affects the positions of the fields, not their tab (or processing) order.
When you run
p-form4.p
, press TAB to move through the fields. Notice that the cursor moves among the fields in the order they are listed in the UPDATE statement:
NOTE: The AT n option, where n is an integer, specifies the column position of the field. Progress chooses the row based on the previous widget and form item layout of the frame. Form items include SKIP and SPACE. For more information on form items, see the reference entries for the DEFINE FRAME statement and the FORM statement in the Progress Language Reference .This procedure produces the following output:
![]()
Note that because the DEFINE FRAME statement is used, the frame is scoped to the FOR EACH block. It, therefore, becomes a down frame. A FORM statement would have scoped the frame to the procedure block, making it a one-down frame. For more information on frame scoping, see Frames."
The syntax of the AT phrase of the FORM and DEFINE FRAME statements can specify either the absolute column and row, or the X and Y coordinates of the display field. You can also position a field relative to a previously positioned field.
For more information on this syntax, see the AT Phrase reference entry in the Progress Language Reference .
The following sample fragment specifies X and Y coordinates for two fields in a frame:
If you position a field with X and Y coordinates, the position of the field depends on the resolution of the terminal on which the procedure is compiled and run. For example, if the resolution is 640 by 480 and you specify X 320, the field is displayed at the midpoint of the display. If you run the same procedure on a display with a resolution of 1280 by 960, the field is displayed at the one-quarter point of the screen.
Most interfaces provide a font that is compatible with the screen resolution. An 80-column display width is common across most platforms. Therefore, if you use character (ROW and COLUMN) coordinates rather than pixel (X and Y) coordinates, your code is more portable. Because Progress allows you to specify fractional character units, you can still specify very precise locations for a graphical environment. In a character environment, the ROW and COLUMN values are truncated to integer values.
Describing Frame Headers
You can use the FORM or DEFINE FRAME statement to describe a header that appears at the top of a frame. For example, the FORM statement in this procedure defines a frame that consists of only a header. The VIEW statement brings that frame into view. The DISPLAY statement uses a separate frame (the default frame for the FOR EACH block).
This procedure produces the following output:
![]()
Form Backgrounds
The BACKGROUND option of the FORM and DEFINE FRAME statements allow you to specify a rectangle or image to display in the background for a frame. The contents of the frame (both header and data) are displayed on top of the background.
For example, the following procedure displays a rectangle in the background of a frame:
This procedure produces the following output:
![]()
Note that you must define a rectangle or image before referencing it in the DEFINE FRAME or FORM statement.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |