How Do I Exit a Program from a Subtask Level? (Magic xpa 4.x)
Very often, you will have a stack of related tasks running together. Sometimes these tasks even look like one screen, so when the user presses an Exit button, they expect the entire stack of tasks to exit.
The best way to do this is to use your event handler as shown below.
Here we have Task A and Task B. When you click on the Close button in Task A, what normally will happen is that it closes both tasks. But when you close Task B, it will close Task B and control will revert to Task A.
So, how do we make closing Task B also close Task A?
-
First, make the close button raise an Exit event. This is the same event that gets raised if the user clicks on the X or presses Esc, so we cover all the bases that way.
-
Next, create a handler that is triggered by the Exit event. The handler will be triggered by Exit, but will also allow it to propagate, which will close Task B.
-
In the handler, raise another event, again, an Exit event. This event will then close Task A.
While we showed two separate tasks here for clarity, this would ordinarily be used when Task B is a subform task of Task A.
How Do I Automatically Return Back to the Parent Form by Tabbing Out of the Last Control of the Subform Display?
The Online and Rich Client Samples projects (program TS19 and RTS19)