Progress
Programming
Handbook


Frame Allocation

Each statement that displays data or prompts you to enter data uses a frame for display or input of that data. A procedure can use many different frames. Progress uses these guidelines to determine which frame a particular statement uses to display data:

Progress automatically allocates a frame for REPEAT, FOR EACH, triggers, and procedure blocks that display data. If you do not use the Frame phrase with these blocks, Progress creates an unnamed frame. The unnamed frame is the default frame for the block. If you name a frame in the block header, that frame becomes the default frame for the block and Progress does not allocate an unnamed frame for that block. Progress scopes the frame named in the block header statement to that block if it is the first block to reference the frame.

If you do not specify a default frame for a DO block in the block header, the default frame for the DO block is the default frame for the nearest enclosing FOR EACH, REPEAT, trigger, or procedure block, or the nearest enclosing DO block that explicitly names a frame.

Progress creates separate frames for DO blocks only if you specify a frame phrase in the DO statement. If the frame phrase contains the FRAME keyword and names a new frame, then Progress creates a separate frame and that frame is the default frame for the DO block. If the frame phrase does not contain the FRAME keyword, then Progress creates a new unnamed frame and that becomes the default frame for the DO block.

This procedure demonstrates frame allocation for the procedure block and a REPEAT statement:

p-bkchp6.p
/* The default frame for the procedure block is an unnamed 
   frame.The first DISPLAY statement uses a different frame, 
   aaa.The default frame for the REPEAT block is bbb.The 
   PROMPT-FOR statement does not use the default frame for the  
   block;instead it uses frame aaa.The DISPLAY statement uses 
   the default frame for the REPEAT block.                      */ 
DISPLAY "Customer Display" WITH FRAME aaa. 
REPEAT WITH FRAME bbb: 
  PROMPT-FOR customer.cust-num WITH FRAME aaa. 
  FIND customer USING cust-num. 
  DISPLAY customer WITH 2 COLUMNS. 
END. 

In this procedure, Progress allocates frame aaa to the procedure block. This frame is not the default frame for the procedure block. If a subsequent statement in the procedure block displayed data without naming a frame, Progress would create an unnamed frame and it would be the default frame for the procedure block. As it stands, the procedure block has no default frame. The default frame for the procedure block is always an unnamed frame.

The default frame for the REPEAT block is frame bbb. Since the DISPLAY statement contained within the REPEAT block does not specify a frame, it uses the default frame bbb.

Frame Scope

The scope of a frame is the outer-most block in which you reference that frame. (Hiding a frame or setting its VISIBLE attribute does not scope the frame; nor does the DEFINE FRAME statement.) The following procedure demonstrates this:

p-bkchp7.p
/* The scope of frame aaa is the procedure block because 
   that is the first block that references frame aaa.    */ 
DISPLAY "Customer Display" WITH FRAME aaa. 
REPEAT: 
  PROMPT-FOR customer.cust-num WITH FRAME aaa. 
  FIND customer USING cust-num. 
  DISPLAY customer WITH 2 COLUMNS. 
END. 

Progress scopes every frame to a block. Scoping a frame to a block does not make that frame the default frame for the block. Progress automatically scopes frames to REPEAT, FOR EACH, and procedure blocks. Progress only scopes frames to DO blocks if you indicate a new frame in a frame phrase (DO WITH FRAME).

Frame Services

Progress provides these services for each of the frames scoped to a block:

Progress determines when to provide these services based on the block to which it scopes the frame. For more information on frame scoping, see Frames."

Borrowed Frames

Any trigger or internal procedure can reference frames that are scoped to the containing procedure. A user interface trigger for a frame or field-level widget automatically borrows the frame for that widget from the containing procedure. This holds true even if the frame is the default (unnamed) frame. This allows you to reference the field value within the trigger without specifying the frame. You can borrow other frames by referencing them within the trigger or internal procedure. For example, the following procedure contains several instances of borrowed frames:

p-borfrm.p
FORM 
   Customer.Name LABEL "Search String" 
   WITH FRAME prompt-frame. 
FORM 
   Customer.Name Customer.Credit-limit 
   WITH FRAME upd-frame. 
ON NEXT-FRAME OF Customer.Name IN FRAME prompt-frame 
   DO: 
      FIND Customer USING Customer.Name. 
      DISPLAY Customer.Name Customer.Credit-limit WITH FRAME upd-frame. 
      ENABLE Customer.Credit-limit WITH FRAME upd-frame. 
   END. 
ON LEAVE OF Customer.Credit-limit 
   ASSIGN Customer.Credit-limit. 
STATUS INPUT "Press " + KBLABEL("NEXT-FRAME") + " to search; " + 
             KBLABEL("END-ERROR") + " to exit". 
ENABLE Customer.Name WITH FRAME prompt-frame. 
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

In p-borfrm.p, a LEAVE trigger is defined for the Credit–limit field in upd–frame. Because the trigger borrows that frame, you do not have to qualify the field reference in the ASSIGN statement with the frame name. The ON statement for the NEXT–FRAME trigger of the Name field explicitly references prompt–frame. Therefore, Progress assumes that frame when you reference the Name field in the FIND statement. The DISPLAY and ENABLE statements explicitly borrow the upd–frame from the outer procedure.


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