Example Frame Calling Sequence
In this example, Top calls Frame2, Frame2 calls Frame3, and Frame3 calls Frame4. This can be illustrated as:
Top
Frame2
Frame3
Frame4
The application developer wants to allow the application user to return directly to the Top frame from Frame4 without displaying the forms for Frame3 or Frame2.
To return from Frame4, pass a known return code (say 11) to indicate "gotoTopFrame." Test for this return code in the calling routine and pass the same return code back to its calling routine, and so on, until the program has proceeded all the way back to the Top frame.
For example, to implement a new menu item Top in Frame4 that the application user can select, use this syntax:
Top =
begin
return 11;
end
Frame3 receives Frame4's return code in the local variable Status via the following code fragment:
initialize (status = i4) = {}
Menuitem =
begin /* Frame3 code that calls */
/* Frame4 */
status := callframe Frame4 ;
if status = 11 then
return 11 ; /* Frame3 also returns */
else
statements
endif;
end
When control passes back to Frame3 after Frame4 issues the return 11 statement, several things happen:
• The application passes a value of 11 into Frame3's hidden field, Status.
• In Frame3, processing resumes at the statement immediately following the callframe Frame4 statement. This is an if test on Status to check for a return code of 11.
• If the if test finds a value of 11 in Status, then Frame3 returns a value of 11 to Frame2, and Frame2 similarly returns 11 to the Top frame.
Last modified date: 04/03/2024