Progress
Programming
Handbook


FRAME–ROW and FRAME–COL Options

When you design an application, you can control where a frame appears on the screen and where one frame overlays another. Progress has several functions that let you control the position of frames in relation to the screen and in relation to other frames.

In the following procedure, the FRAME–ROW and FRAME–COL functions indicate the location of the order-information frame on the customer-information frame.

NOTE: The FRAME–ROW and FRAME–COL attributes have no relation to the FRAME–ROW and FRAME–COL functions. These attributes return the position of a child field-level widget relative to the upper left-hand corner of the parent frame. However, for child frames, the ROW and COLUMN attributes return the position relative to the upper left-hand corner of the parent frame. For more information on child frames, see Frames."

p-frrow.p
cust-loop:
FOR EACH customer:
        DISPLAY customer WITH FRAME cust-frame 
                2 COLUMNS TITLE "CUSTOMER INFORMATION".
        FOR EACH order OF customer
                    ON ENDKEY UNDO cust-loop, LEAVE cust-loop:
          DISPLAY order-num order-date ship-date promise-date
                  carrier instructions po
                  WITH 2 COLUMNS 1 DOWN OVERLAY TITLE "CUSTOMER’S ORDERS"
                       ROW FRAME-ROW(cust-frame) + 8
                       COLUMN FRAME-COL(cust-frame) + 1.
        END.
END. 

The FRAME–ROW and FRAME–COL functions each return an integer value that represents the row or column position of the upper-left corner of the named frame. In the example, the FRAME–ROW function returns the value of the row position of the uppermost corner of the cust–frame. Then the procedure adds 8 to that value and displays the overlay frame at that row position. The column position is calculated to be 1 to the right of the right edge of cust–frame.

This procedure produces the following output:

If you move cust–frame to the third row on the screen, the FRAME–ROW and FRAME–COL functions place the order information frame in the same position relative to the customer information frame–below the eighth row and next to the first column of cust–frame. The following procedure shows this adjustment.

p-frrow1.p
cust-loop:
FOR EACH customer:
        DISPLAY customer WITH FRAME cust-frame ROW 3
                2 COLUMNS TITLE "CUSTOMER INFORMATION".
        FOR EACH order OF customer
                    ON ENDKEY UNDO cust-loop, LEAVE cust-loop:
          DISPLAY order-num order-date ship-date promise-date
                  carrier instructions po
                  WITH 2 COLUMNS 1 DOWN OVERLAY TITLE "CUSTOMER’S ORDERS"
                       ROW FRAME-ROW(cust-frame) + 8
                       COLUMN FRAME-COL(cust-frame) + 1.
        END.
END. 

See the Progress Language Reference for more information on the FRAME–ROW and FRAME–COL functions.

In most cases, a dialog box is better than an overlay frame. For example, p-frrow2.p is similar to p-frrow1.p, but uses a simple dialog box instead of the overlay frame:

p-frrow2.p
DEFINE BUTTON ok-button LABEL "OK" AUTO-GO.
DEFINE BUTTON cancel-button LABEL "CANCEL" AUTO-ENDKEY.

cust-loop:
FOR EACH customer:
        DISPLAY customer WITH FRAME cust-frame ROW 3
                2 COLUMNS TITLE "CUSTOMER INFORMATION".
        FOR EACH order OF customer
                    ON ENDKEY UNDO cust-loop, LEAVE cust-loop:
          DISPLAY order-num order-date ship-date promise-date
                  carrier instructions po SKIP
                  ok-button AT 25 cancel-button AT 50
                  WITH 2 COLUMNS 1 DOWN OVERLAY TITLE "CUSTOMER’S ORDERS"
                       ROW FRAME-ROW(cust-frame) + 8
                       COLUMN FRAME-COL(cust-frame) + 1
                       VIEW-AS DIALOG-BOX.  
          SET ok-button cancel-button.
        END.
END. 

When you run this code in a graphical interface, you can move the dialog box to see all the data in both frames. For more information, see the discussion of dialog boxes later in this chapter.


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