Search code examples
installshield

Dynamically cancel ControlEvent in InstallShield


I'm using InstallShield 2013 SP1. In a dialog, I have the following ControlEvents on the Next PushButton:

Event     | Argument       | Condition
__________|________________|___________________________
NewDialog | CustomSetup    | CANCEL_NAVIGATION <> "1"
DoAction  | MyCustomAction | _IsSetupTypeMin = "Custom"

The idea is that MyCustomAction does its thing, and then sets the property CANCEL_NAVIGATION to 1 if the NewDialog event should be canceled. However, the conditions are evaluated before the custom action is executed, so even if the CANCEL_NAVIGATION is set, the new dialog is spawned anyway.

If it's not possible to evaluate the condition afterwards, or circumvent this behavior in any way, some other solution, such as executing another custom action in the next dialog evaluating the property and relaunching the first dialog.

Disabling the Next button is not an option, as the behavior of my dialog is to launch a file selection window when Next is pressed (if certain conditions are met), and only if this dialog is canceled, so should the navigation to the next window.

I have considered adding a button to the dialog launching the file selection dialog instead, but this answer will not be accepted, as I would much prefer the described behavior to remain intact.


Solution

  • As it turns out, I had misunderstood the ordering of the ControlEvents. For some reason, I thought they were evaluated from bottom to top, since my DoAction was evaluated even though a NewDialog was configured above. Switching the lines fixed my problem:

    Event     | Argument       | Condition
    __________|________________|___________________________
    DoAction  | MyCustomAction | _IsSetupTypeMin = "Custom"
    NewDialog | CustomSetup    | CANCEL_NAVIGATION <> "1"