I have a simple custom action that I've inserted before the SetupProgress
dialog that displays a AskOptions
dialog offering some shortcut options.
For the most part, I have it behaving as expected, but there is one behavior I cannot figure out. If the user clicks the back button, I want it to go to the previous dialog and not continue to SetupProgress
dialog. I use the following code for my dialog (minus the code that actually creates shortcuts).
function MyFunction(hMSI)
NUMBER nResult;
STRING szMsg, szText1, szText2, szText3;
NUMBER nReturn, nValue, nvCheck1, nvCheck2, nvCheck3;
begin
SetDialogTitle(DLG_ASK_OPTIONS, "More Options");
szMsg = "Select from the additional options below.";
szText1 = "Shortcut option 1";
szText2 = "Shortcut option 2";
szText3 = "Shortcut option 3";
nvCheck1 = TRUE;
nvCheck2 = TRUE;
nvCheck3 = FALSE;
// Display the check box (NONEXCLUSIVE) dialog.
nValue = NONEXCLUSIVE;
nResult = AskOptions (nValue, szMsg,
szText1, nvCheck1,
szText2, nvCheck2,
szText3, nvCheck3);
//This is the troublesome code... Not sure how to handle this...
//if (nResult = BACK) then
// goto [Where?];
//endif;
end;
As you can see, there is a line near the bottom where I could handle the back button, I just have no clue as to how to actually go back to the previous dialog.
I would suggest not trying to interleave Basic MSI table-driven dialogs and InstallScript code-driven dialogs. It's going to be difficult, and likely will result in some odd parenting issues at best, or loss of focus at worst.
The goto <previous dialog label>;
approach works as part of a script that shows several dialogs. By jumping backwards, it then shows the dialog that comes after that label as the next one. So you want to simulate that somehow. If you are showing this InstallScript dialog from a Control Event, perhaps you should have it set a property that enables you to determine what dialog to show next. For example, if you set a property DLGBUTTON to NEXT or BACK, you can create two NewDialog Control Events with mutually exclusive conditions based on the value of DLGBUTTON. If this custom action is being invoked somewhere else, adjust the invoker accordingly.
But, if possible, try to implement this dialog using the MSI tables, and avoid a lot of difficulties with a non-cohesive UI.