11. Managing Event Queues : Event-based Programming : Event Types : Frame Events
 
Share this page                  
Frame Events
Frame events include events that are triggered by user interactions with the frame's window, such as the WindowResized event that is triggered when the user resizes the window. Frame events also include interactions with the background of the frame, such as the Details event, which is triggered for the frame when the user clicks the Details button on the area surrounding the fields.
The following sample script shows the event block for the WindowIcon frame event. This event is triggered whenever the user iconifies the frame. The code in Step 2 prevents the child, graphic_frame, from remaining displayed if the parent frame is iconified. If a user iconifies the parent frame, this event does the following:
1. Verifies that graphic_frame is displayed.
2. Sets the WindowVisibility of that frame to iconify.
on windowicon =
begin
   if graphic_frame is not null then
       graphic_frame.WindowVisibility = WV_ICON;
   endif;
end
A frame also receives child events when the user interacts with the fields on the form. Because the form associated with a frame is considered a single subform containing all non‑menu fields on the frame, events triggered in any field also trigger a child event for the frame. This enables the frame to provide generic code that is triggered when any of the fields on its form receive a particular event.
For example, a frame receives a ChildEntry event when any of its child fields receives an Entry event. The following ChildEntry event block changes the color of the field that the user has entered to pale cyan. This code uses the TriggerField attribute of the FrameExec system class to determine which entry field triggered the current event:
on childentry =
begin
    if CurFrame.TriggerField.ISA(class =
        EntryField) = TRUE then
            EntryField(CurFrame.TriggerField).
            BgColor=CC_PALE_CYAN;
    endif;
end
WindowClose and Terminate are two other important frame events:
WindowClose
Is triggered when the user selects the window manager close operation for the running frame.
Terminate
Is triggered in any of the following circumstances:
When the frame is closed by the Terminate method
When the frame's parent frame closes itself
When the frame's parent is itself closed by another frame or procedure
When the user selects the window manager Close operation for the running frame
You can use an event block for either the WindowClose or Terminate events to clean up a frame (for example, to close open transactions) prior to closing it. To keep the window open under specified circumstances, use the WindowClose event. For more information about keeping a window open after a WindowClose event has been triggered, see How You Can Interrupt an Event Block (see How You Can Interrupt an Event Block).
The UserEvent event, which is a user‑defined event used primarily for communicating between frames and with external programs, is also considered a frame event. For more information about this event, see Inter-Frame Communication Techniques (see Inter-Frame Communication Techniques).
For more information about OpenROAD events in general, see the Language Reference Guide.