Final Processing Stage [EndControl]
The default flow of the wizard is that the user can move freely back and forth between the Init state and the Finish state. When the user clicks the Finish button, there is no more interaction with the user and the wizard window closes after any residual processing is complete.
If the final processing is likely to take some time, it is good user interface design to present a progress indication while processing completes, and then have a final landing point when everything is finished.
The method EndControl will alter this final stage. It takes three parameters:
- HideOverlay valid and non-zero to hide the final window overlay
- FinalTitle a text string to override the default title on the final screen
- FinalText a text string to override the default text on the final screen
Notes:
- If any of these parameters is invalid, that parameter is ignored
- The two character sequence "^W" in the FinalTitle will be replaced by the Wizard’s name
This method is as follows:
When moving forward from the Finish state (i.e. the Finish button has been clicked) call EndControl(1) to hide the overlay window. This will return the wizard display to be that which normally shows between the start and finish states. Your wizard code can now draw text, progress bars etc to keep the user informed.
You can change states (using the ForceState method to do this) and this window will remain on display.
When all processing is complete, change to a final state and call EndControl(0, "Title", "Message"). The window will change to the usual final screen, except that you can (optionally) replace the title and message text. The only button that is enabled is the Finish button and when this is clicked, you should terminate the wizard.
The following code sample is an example of using these features. In this example, the normal finish screen shows the Finalcheck box. If it is checked, then the wizard enters the two stage finish.
Finish [ Msg = "This is the final state in the Wizard." + CRLF + CRLF + "However, if you wish to test the extended finish " + "features, then tick the check box."; Engine\EndControl(Invalid, Invalid, Msg); Engine\FinalCheckBox(ExtendedFinish, "Use extended finish", 1); Engine\NextIs(ExtendedFinish ? "LongFinish" : "AllDone"); If Move; [ Move = 0; ForceState(NextState); ] ] LongFinish [ WTitle = "Extended Finish"; Msg = "We are waiting here for 10 seconds to simulate ongoing background tasks." + CRLF + CRLF + "At the end of that time we will automatically advance to the end of the Wizard."; \System.TextBox(LHS, TOP + 65, RHS, TOP + 17, Msg, \_DialogFont, 5); Engine\EndControl(1 {Hide Overlay}); Engine\ForceMove(TimeOut(1, 10), "DoneDone"); If Move; [ Move = 0; ForceState(NextState); ] ] DoneDone [ Engine\EndControl(0 {Unhide overlay}, "The ^W is totally finished!", "We really are all done now." + CRLF + "Thank you for your patience."); If Move; [ Move = 0; ForceState(NextState); ] ] AllDone [ If !Cancel; [ { All done now, let’s get out of here } Cancel = 1; ] ]