Progress
Programming
Handbook
Using Shared Frames
Sometimes you want several procedures to use the same frame. You might use the same frame throughout an application or with a few different procedures in an application. Progress lets you define a frame as shared, so that many procedures can use it. You use the DEFINE SHARED FRAME statement to define a shared frame. You must describe the shared frame in a FORM statement.
You can write a procedure to display customer information, another procedure to update order information, and you can display all the information in the same frame. One way to do this is to define a shared frame.
Figure 19–9 shows how two procedures can use the same frame.
p-dicust.pp-updord.pp-dicust.iFigure 19–9: Shared Frames
![]()
The FORM statement in this example is in an include file,
p-dicust.i
. This file sets up and names the cust–frame:
Although you cannot run the
p-dicust.i
file by itself because it is only a FORM statement, the file describes the following frame:
![]()
The
p-dicust.p
procedure displays customer information in this frame:
The
p-dicust.p
procedure displays customer information in the shared frame cust–frame and lets the user update the order information for the customer on the screen. The procedure defines the new shared frame named cust–frame and a new shared buffer, xcust, to store customer information. (You can use only one DEFINE SHARED FRAME statement per frame in a procedure.) The name cust–frame corresponds to the frame in the FORM statement in thep-dicust.i
include file.The procedure prompts the user for a customer number and displays the customer information for that customer using the frame defined in the
p-dicust.i
file. Then the procedure calls thep-updord.p
procedure, shown below:
The
p-updord.p
procedure defines the shared frame cust–frame and the shared variable csz, which was first defined in thep-dicust.p
procedure. It also defines the shared buffer to store customer information. You must use the DEFINE SHARED VARIABLE statement for the csz variable because variables named in a shared frame are not automatically shared variables. You must also use the DEFINE SHARED FRAME statement for the cust–frame so that Progress can recognize the frame.The
p-updord.p
procedure finds the customer that thep-dicust.p
procedure is using in the shared buffer, xcust. The procedure then displays the information for each order of the customer in the shared frame called cust–frame. Finally, the procedure allows the user to update the order information.When you use shared frames, remember these important points:
- In the first procedure where you reference a shared frame, use the DEFINE NEW SHARED FRAME statement. In subsequent procedures where you reference the shared frame, use the DEFINE SHARED FRAME statement.
- You must completely describe the shared frame in the initial DEFINE NEW SHARED FRAME statement or an additional FORM statement. Procedures that share this frame only have to define fields that correspond to the fields in the initial definition plus any specified ACCUM option. Other Frame phrase options for the SHARED frames are allowed but are ignored, except for the ACCUM option. This allows you to make use of the same FORM statement in an include file for both the NEW SHARED and matching SHARED frames.
- A shared frame is scoped to the procedure or the block within the procedure that defines it as NEW. For example, in the
p-updord.p
procedure above, thep-dicust.i
include file has no effect on scope.- A shared frame is scoped only once, and the scope is in the procedure where the frame is defined as NEW.
- If you want to share a frame family, you must make all parent and child frames in the family shared frames.
See the Progress Language Reference for more information on the DEFINE FRAME statement.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |