Programming Guide : Programming Frames : How You Can Invoke Frames : FrameExec Object
 
Share this page          
FrameExec Object
Each time you open a frame with the openframe, callframe, or gotoframe statement, OpenROAD creates a FrameExec object for the frame. FrameExec is the OpenROAD system class that contains information about the running instance of a frame, such as the parent frame, the list of fields that are currently selected, and the starting menu for the frame. The FrameExec object also provides methods for manipulating the frame, such as the SendUserEvent method for communicating with other frames and the methods for opening predefined pop‑up frames. For a complete list of the FrameExec attributes and methods, see the Language Reference Guide online help.
There is one FrameExec object for each running instance of the frame. If you open the same frame more than once, OpenROAD creates a separate FrameExec object for each instance of the frame.
How the CurFrame System Variable Works
To access the FrameExec object for the current frame from OpenROAD, use the CurFrame (for current frame) system variable. CurFrame can be used to change attributes such as:
The size of the frame
The background color of the frame
The field that receives the input focus after the current event block has completed
For more examples of using CurFrame and information about how to reference the FrameExec object of another frame, see Inter-Frame Communication Techniques.
How Frames Access Child and Parent Frames
CurFrame is also useful in letting a child frame access its parent (regardless of whether the child was opened or called by the parent frame). A child frame can always access its parent by using the value of the FrameExec's ParentFrame attribute, as in the following example:
parent_frame = FrameExec(CurFrame.ParentFrame);
It later uses the value of parent_frame to send a UserEvent to the parent.
If you want to change an opened frame's parent or enable two frames to communicate with each other, you can specify a FrameExec object as the ParentFrame in the with clause of the openframe statement. For example, a parent frame can pass a null FrameExec to a child frame, establishing the child as a detached frame. If the parent frame closes, the child remains open. For more information about using the with clause, see How You Can Change a Frame's Definition.
The parent can also assign the opened child to a different parent by specifying a third frame's FrameExec as the child's ParentFrame. You might change a frame's parent to allow the child frame to remain open when the frame that called it closes. The following illustration demonstrates two frames, Frame_B and Frame_C, that are opened from Frame_A. Frame_D is opened by Frame_C. If Frame_C closes, Frame_D closes automatically. To allow Frame_D to remain open after Frame_C closes, you could parent Frame_D to Frame_B or Frame_A.
For Example, to change Frame_D's parent from its calling frame (Frame_C) to that frame's parent (Frame_A), you would type:
openframe Frame_D with parentframe =
    FrameExec(Curframe.Parentframe);
Note:  Because the data type of the ParentFrame attribute is ProcExec, the previous statement converts it to FrameExec. The process used to convert the data type is called casting. For more information about casting, see How You Can Work with Attributes on page 90.
You can also enable two child frames to communicate with each other by passing the appropriate FrameExec to a child or storing a FrameExec object in a global variable.
A child frame can always communicate with its parent by accessing the value of the ParentFrame attribute. For a parent frame to access its child, it must get the child's FrameExec object when it opens the child. The openframe statement provides access to the FrameExec object for the child frame. For an explanation of obtaining the FrameExec object of the called frame from the return value of the openframe statement, see How You Can Communicate Between Open Frames.
Access to a frame's FrameExec object lets you use the SendUserEvent method to send events to the called frame. For more information about communicating between frames, see Inter-Frame Communication Techniques.