3. Programming Frames : How You Can Invoke Frames : How You Can Transfer Control Between Frames : How You Can Close a Frame
 
Share this page                  
How You Can Close a Frame
To close a frame, use the return statement. This statement closes the frame and returns control to the calling frame. The following example shows how the return statement is used to take users back to the control frame when they click the Close button or close the window:
on click close_button,
on windowclose =
begin
    cleanup processing statements
return;
end
In addition, when you return from a frame invoked by the callframe statement, you can use the return statement to pass a return value back to the calling frame.
For more information about returning from the openframe, callframe, and gotoframe statements, see the following sections:
How You Can Open Concurrent Frames: Openframe Statement (see How You Can Open Concurrent Frames: Openframe Statement)
How You Can Transfer Control to a New Frame: Callframe Statement (see How You Can Transfer Control to a New Frame: Callframe Statement)
How You Can Pass Control While Closing the Parent: Gotoframe Statement (see How You Can Pass Control While Closing the Parent: Gotoframe Statement)
A return statement for the starting frame of the application closes all frames in the application and returns control to the level where the user entered the application. To allow users to return to the operating system, the starting frame for your application should include a Quit operation (either as a menu operation or a button) that executes the return statement. For more information about the return statement, see the Language Reference Guide.
If there is some reason for the user to be able to leave the application from a frame other than the starting frame, use the exit statement. This statement closes all open frames and returns control to the level where the user entered the application. For more information about the exit statement, see the Language Reference Guide.