Progress
Programming
Handbook


Viewing and Hiding Frames

Progress brings a frame into view when you display data in that frame. You can also use the VIEW statement (or you can set the frame’s VISIBLE attribute to TRUE) to explicitly bring a frame into view. You can use the HIDE statement to explicitly hide a frame (or you can set the frame’s VISIBLE attribute to FALSE).

NOTE: If a parent or ancestor window of a frame has its HIDDEN attribute set to TRUE, you can set the frame’s attributes (directly or indirectly with VIEW and data display statements) to display the frame, but Progress does not display the frame until all ancestor windows have their HIDDEN attributes set to FALSE.

When displaying frames within a window, Progress tiles the frames, starting at the top of the window and proceeding to the bottom until the window is full. By default, every frame begins at column 1. If there are more frames than fit in the window, Progress hides (erases) the frames closest to the bottom of the window until enough space is cleared to display the next frame. If ready to hide a frame, Progress pauses, by default, and displays the message “Press space bar to continue”.

Within a window, you can display one frame over another using the OVERLAY option, and you can make a frame fit in a display area that is smaller than the frame itself, using the SIZE option of the Frame phrase. For more information on the SIZE option, see Interface Design."

Bringing Frames into View

You can bring a frame into view by displaying data in that frame, using the VIEW statement, or setting the frame’s VISIBLE attribute to true. In the following procedure, the DISPLAY statement brings the frame into view:

p-form1.p
FORM customer.name contact AT 40 SKIP
     customer.address credit-limit AT 40 SKIP
     customer.city customer.state NO-LABEL
     customer.postal-code NO-LABEL balance AT 40 SKIP(1)
     phone
     HEADER "Customer Maintenance" AT 25 SKIP(1)
     WITH SIDE-LABELS NO-UNDERLINE FRAME a.

FOR EACH customer WITH FRAME a:
  DISPLAY curr-bal.
  UPDATE name address city state postal-code phone contact credit-limit.
END. 

The FORM statement describes frame a. To bring the frame into view before the DISPLAY statement, you can use the VIEW statement. In the next example, the VIEW statement brings frame b into view.

p-form2.p
DEFINE FRAME b WITH ROW 7 CENTERED SIDE-LABELS
       TITLE "Customer Info".

VIEW FRAME b.

REPEAT:
  PROMPT-FOR customer.cust-num WITH FRAME a ROW 1.
  FIND customer USING cust-num NO-LOCK.
  DISPLAY customer EXCEPT comments WITH FRAME b.
END.    

In the next example, Progress automatically removes frames from the screen by hiding them:

p-hide.p
FOR EACH customer:
  DISPLAY name WITH FRAME f1 DOWN.
  DISPLAY credit-limit WITH FRAME f2.
  FOR EACH order OF customer WITH FRAME f3:
    DISPLAY order-num.
  END.
END. 

The output of this procedure is as follows:

At this point, the procedure has displayed the customer name. But there is no more vertical space on the screen in which to display the max–credit and order numbers. Press SPACEBAR.

You can see that Progress automatically hides frame f1 to make room for frames f2 and f3. When Progress runs out of space, it hides frames starting from the bottom of the window.

Using Overlay Frames

Progress allows you to create a frame that overlays another frame. To display one frame over another, set the top frame’s OVERLAY attribute to true (or use the OVERLAY frame phrase option). Also, make sure that the bottom frame’s TOP–ONLY attribute is set to false. Progress displays a message before it displays the overlay frame.

For example, you might want to display all the information for a customer, then see that customer’s orders one at a time while keeping at least some of the customer information in view. The following procedure uses an overlay frame to accomplish this:

p-ovrlay.p
FOR EACH customer:
    DISPLAY customer WITH 2 COLUMNS TITLE "CUSTOMER INFORMATION".
    FOR EACH order OF customer:
        DISPLAY order-num order-date ship-date promise-date carrier 
                instructions WITH 2 COLUMNS 1 DOWN OVERLAY
                TITLE "CUSTOMER’S ORDERS" ROW 7 COLUMN 10.
    END.
END. 

This procedure produces the following output:

When you press SPACEBAR, if the customer has orders, you see the customer’s first order in a frame that overlays the first frame on your screen, as shown in the following figure:

When you press SPACEBAR, the next customer appears, the order frame clears, and the next order for the customer appears. Progress automatically refreshes a covered frame when an overlay frame clears.

The p-ovrlay.p procedure displays the frame with the order information over the frame with the customer information because the frame phrase for the order frame includes the OVERLAY option. You can use the ROW and COLUMN options to control where the overlay frame is placed on the screen. If you do not include the ROW and COLUMN options, the overlay frame displays with the upper left corner in row 1, column 1 (unless you use some other option to affect its placement, such as the CENTERED option).

Working with Multiple Overlay Frames

If every frame is an overlay frame and no frame has its TOP–ONLY attribute set to TRUE, you can bring any overlay frame to the top by giving focus to one of its field-level widgets. You can also prevent all overlay frames from changing their current overlay position (Z order) by setting the window’s KEEP–FRAME–Z–ORDER attribute to TRUE. No matter how this attribute is set, you can always change the Z order of an overlay frame using these methods:

The default Z order of multiple overlay frames is the order in which they are enabled.

Child frames are actually permanent overlay frames of their parent frame. When you overlay several child frames, they maintain their collective Z order on top of the parent frame. However, you can change the relative Z order of the child frames within the parent using these methods.

For more information on the OVERLAY option of the Frame phrase and the methods changing frame Z order, see the Progress Language Reference .

NOTE: Dialog boxes also appear on top of other frames and may be preferable to overlay frames. For more information on dialog boxes, see "Interface Design," and the Progress Language Reference .

Viewing and Hiding Frame Families

When you view and hide a parent frame, all of its child frames and field-level widgets whose HIDDEN attributes are set to FALSE are viewed and hidden with it. The viewing and hiding of child frames also works as it does for field-level widgets.

When you use the VIEW statement to view a child frame, Progress views the child frame and all of its ancestor frames, even if their HIDDEN attributes are set to TRUE. If necessary, Progress resets their HIDDEN attributes to FALSE. However, if you use the DISPLAY or ENABLE statement to view a child frame, Progress sets the attributes appropriately to display the child frame, but only displays it on the screen if none of its ancestor frames have their HIDDEN attributes set to TRUE. In this case, when all ancestor frames have their HIDDEN attributes set to FALSE, the previously displayed or enabled child frame is then displayed on the screen.

When you hide a child frame, like a field-level widget, its HIDDEN attribute is set to TRUE. Thus, if you later hide and redisplay an ancestor frame, the hidden child frame stays hidden until you explicitly view or display it.

When you run the sample procedure p-fof3.p, the following window appears, which lets you view and hide frame families:

Figure 19–8: Frame Family Viewing Demo

You can hide and view each frame and fill-in, displaying the HIDDEN and VISIBLE attribute values in the message area as appropriate.


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