WixNoob
WixNoob

Reputation: 41

Wix installer - conditionally display "Launch application" on ExitDialog based on custom dialog input

I'm new to Windows Installer and Wix so please forgive the newbie question.

I'm using WixUI_InstallDir and added a custom dialog that shows 3 checkboxes after LicenseAgreementDlg and before InstallDirDlg. Is there a way to conditionally show the "Launch installed application" checkbox on the ExitDialog only when the first checkbox is checked and the installer is executed for the first time?

In my wxs file, I have

<!-- Property for each checkbox value (first checkbox checked by default) -->
<Property Id="Checkbox1" Value="1"/>
<Property Id="Checkbox2"/>
<Property Id="Checkbox3"/>

<!-- Custom action to set exit dialog checkbox -->
<CustomAction Id="CA_Set_WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch application."/>

<InstallUISequence>
    <Custom Action="CA_Set_WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" After="FindRelatedProducts">Checkbox1 = 1 and NOT Installed</Custom>
</InstallUISequence>

<!-- User Interface -->
<UI>
    <UIRef Id="WixUI_InstallDir"/>
    <UIRef Id="WixUI_ErrorProgressText"/>
    <DialogRef Id="MyCheckboxesDlg"/>
    <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="MyCheckboxesDlg" Order="3">LicenseAccepted = "1"</Publish>
    <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="MyCheckboxesDlg">1</Publish>
</UI>

My problem is that if I uncheck the first checkbox, the Checkbox1 property value is set to 0 after the InstallUISequence ends so the launch app in the exit dialog is still displayed.

Where should I set the property, in the UISequence or ExecuteSequence?

Upvotes: 3

Views: 2829

Answers (1)

WixNoob
WixNoob

Reputation: 41

I think I figured it out... just called the CA_Set_WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT custom action when the Next button in my custom dialog is pressed instead of calling it in the InstallUISequence.

<!-- NO LONGER NEEDED
<InstallUISequence>
    <Custom Action="CA_Set_WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" After="FindRelatedProducts">Checkbox1 = 1 and NOT Installed</Custom>
</InstallUISequence>
-->

<Fragment>
  <UI>
      <Dialog Id="MyCheckboxesDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
        <Control Id="ChkBox1" Type="CheckBox" X="25" Y="75" Width="200" Height="17" Property='Checkbox1' CheckBoxValue='1' >
          <Text>First checkbox</Text>
        </Control>
        <Control Id="ChkBox2" Type="CheckBox" X="25" Y="95" Width="200" Height="17" Property='Checkbox2' CheckBoxValue='1'>
          <Text>Second checkbox</Text>
        </Control>
        <Control Id="ChkBox3" Type="CheckBox" X="25" Y="115" Width="200" Height="17" Property='Checkbox3' CheckBoxValue='1'>
          <Text>Third checkbox</Text>
        </Control>

        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
          <Publish Event="DoAction" Value="CA_Set_WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Order="1">Checkbox1= 1</Publish>
          <Publish Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
        </Control>

        <!-- Other UI controls... -->

    </Dialog>
  </UI>
</Fragment>

Upvotes: 1

Related Questions