Wix - how to publish a 'bad input' dialog and then return to the original dialog?

Go To StackoverFlow.com


I have a WiX setup where the user enters a value (the location of a Java executable) into a regular (non-modal) dialog in the installation UI. I call a custom action to verify that dialog entry, and it correctly sets an environment variable (JAVA_ROOT_DIR_STATUS) to a value ("1" to "6" for errors, "0" if all is okay.) The dialog's Publish sequence does a SpawnDialog to show an error message if the value was bad, then a NewDialog within the same control with the condition the value was good. Per some documentation I just found (http://www.advancedinstaller.com/user-guide/edit-control-event-dialog.html), a given control can only have one or the other--if both SpawnDialog and NewDialog are in the same control, the latter is used and the former ignored.

How then does one implement a check of a user value and an error message saying the value was bad? I've seen recommendations for doing two NewDialogs (which, weirdly enough, does seem to work, but means that the original dialog is no longer displayed and the one-line error message is being shown in a page the same size as the regular pages, which looks really awful.

How would you do a 'popup' on top of the main entry page (if the value is bad), but go to the next page if the value is good?

2012-04-04 19:16
by Dave Combs


I think perhaps that documentation you mention is talking about having a SpawnDialog and NewDialog that both have a true condition. I've done the same thing you describe without any problems.

<Publish Dialog="CustomSetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="InstallDirDlg">CONDITION_OK</Publish>
<Publish Dialog="CustomSetupTypeDlg" Control="TypicalButton" Event="SpawnDialog" Value="WarningDlg">NOT CONDITION_OK</Publish>
2012-04-04 22:52
by Dave Andersen
Thanks--that's the answer. It doesn't actually fix a secondary question I had (how to show something entered on the popup back on the original dialog), but I'll try asking a second question for that if necessary - Dave Combs 2012-04-05 19:02