Dialogs

The Wix toolset provides support for installer dialogs.

Using one of WixUI Built-in Dialog sets the installer will present the user with dialogs e.g. installation location, however although there is some degree of customisation possible, using the default Built-In sets often doesn't provide all the information or inputs required.

In this case custom dialogs can be created as required and together can be used to provide the information and inputs that are needed for a specific installer.

This page provides information on both standard (Built-In) dialogs and custom (user defined) dialogs.


Built-in dialog sets

Wix provides standard Build-in dialog sets (links below open in a new window):

Which provide a set of dialogs that can be used. Ideally, for an installer a specific built-in dialog set would provide all the dialogs that are required, however this is not always the case.

Standard dialogs

As an example within a specific Built-in dialog set there are dialogs e.g.

* BrowseDlg
* CustomizeDlg
* DiskCostDlg
* ErrorDlg
* ExitDialog
* FatalError
* FilesInUse
* MaintenanceTypeDlg
* MaintenanceWelcomeDlg
* MsiRMFilesInUse
* PrepareDlg
* ProgressDlg
* ResumeDlg
* UserExit
* VerifyReadyDlg
* WelcomeDlg

List of Standard Wix Dialogs (opens in new window)

Each of these dialogs has variables that can be set - see the WixUI dialog reference - and as can be seen in the examples below used either to:

  • use in another dialog e.g. present information

or

  • provide information that is used to handle the flow.

Typical uses could be:

First-time install dialog sequenceMaintenance dialog sequence
WixUI_WelcomeDlgWixUI_MaintenanceWelcomeDlg
WixUI_LicenseAgreementDlgWixUI_MaintenanceTypeDlg
WixUI_CustomizeDlgWixUI_CustomizeDlg
WixUI_VerifyReadyDlgWixUI_VerifyReadyDlg
WixUI_DiskCostDlg 

Using a standard dialog set

To use a Built-in dialog set ensure you reference the required set within the "product.wxs" file as shown below, illustrating that the WixUI_InstallDir Dialog Set is to be used.

<!-- Installer UI -->
 <UI>
   <UIRef Id="WixUI_InstallDir" />
 </UI>

Custom dialogs

In addition, it is possible to create your own dialogs. In which case you create a WXS that defines the required dialog. The definition will cover:

  • Geometry
  • Actions
  • Variables

Below is an example of a dialog that will present the user with information gathered whilst running the installer.


<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <!--
  Stuff to set
  - InstallDirDlgBannerBitmap
  -->
  <Fragment>
    <UI>
      <Dialog Id="MyInfoListDlg" Width="370" Height="270" Title="Info">
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>

        <!--<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Description" />-->
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Installation information" />
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />

       <!-- We want to display some of the values we have found -->
        <Control Id="MyInfoListDescription" Type="Text" X="20" Y="60" Width="290" Height="90" NoPrefix="yes" Text="Below is the information relating to this install" />
        <Control Id="SCOPE" Type="Text" X="20" Y="80" Width="290" Height="30" NoPrefix="yes"    Text="Installation scope = [InstallScope]"/>
        <Control Id="PFOLDER" Type="Text" X="20" Y="100" Width="290" Height="30" NoPrefix="yes"  Text="Program install folder = [INSTALLDIR]" />
        <Control Id="EFOLDER" Type="Text" X="20" Y="120" Width="290" Height="30" NoPrefix="yes"  Text="Examples folder = [EXAMPLESFOLDER]"/>
        <Control Id="VNUMBER" Type="Text" X="20" Y="140" Width="290" Height="30" NoPrefix="yes"  Text="Version number = [VERSIONNUMBER]"/>
        <!--<Control Id="EFOLDER1" Type="Text" X="20" Y="160" Width="290" Height="30" NoPrefix="yes"  Text="Examples directory = [EXAMPLESDIRECTORY]"/>-->
      </Dialog>
    </UI>
  </Fragment>
</Wix>

Custom dialog flow

The overall dialog flow can consist of both standard and custom dialogs. The order in which these appear may vary depending on user input when running. The events and logic associated with the presentation of dialogs is defined in a WXS file e.g. MyWixUI.wxs; this file is in turn referenced in the installer "product.wxs" file as follows:

<!-- Installer UI -->
 <UI>
   <UIRef Id="MyWixUI" />
 </UI>

Example MyWixUI.wxs

Below is an example of the UI "flow" definition for a typical installer.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Fragment>

    <UI Id="MyWixUI">
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
      <Property Id="WixUI_Mode" Value="InstallDir" />

      <DialogRef Id="BrowseDlg" />
      <DialogRef Id="DiskCostDlg" />
      <DialogRef Id="ErrorDlg" />
      <DialogRef Id="FatalError" />
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <DialogRef Id="PrepareDlg" />
      <DialogRef Id="ProgressDlg" />
      <DialogRef Id="ResumeDlg" />
      <DialogRef Id="UserExit" />


        <!--   Make sure to include custom dialogs in the installer database via a DialogRef command, 
               especially if they are not included explicitly in the publish chain below -->
      <DialogRef Id="MyLicenseAgreementDlg"/>
      <DialogRef Id="MyExamplesDirDlg" />
      <DialogRef Id="MyInstallDirDlg" />
      <DialogRef Id="MyInstallScopeDlg"/>
      <DialogRef Id="MyInfoListDlg"/>

      <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
      <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="MyLicenseAgreementDlg">NOT Installed</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

      <Publish Dialog="MyLicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
      <Publish Dialog="MyLicenseAgreementDlg" Control="Next" Event="NewDialog" Value="MyInstallScopeDlg">LicenseAccepted = "1"</Publish>


      <Publish Dialog="MyInstallScopeDlg" Control="Back" Event="NewDialog" Value="MyLicenseAgreementDlg">1</Publish>
      <Publish Dialog="MyInstallScopeDlg" Control="Next" Event="NewDialog" Value="MyInstallDirDlg">LicenseAccepted = "1"</Publish>


      <Publish Dialog="MyInstallDirDlg" Control="Back" Event="NewDialog" Value="MyInstallScopeDlg">1</Publish>
      <Publish Dialog="MyInstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="MyInstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
      <Publish Dialog="MyInstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
      <Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog" Value="MyExamplesDirDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
      <Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>


      <Publish Dialog="MyExamplesDirDlg" Control="Back" Event="NewDialog" Value="MyInstallDirDlg">1</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="Next" Event="NewDialog" Value="MyInfoListDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="EXAMPLESFOLDER" Order="1">1</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="Folder" Property="_BrowseProperty" Value="EXAMPLESFOLDER" Order="1">1</Publish>
      <Publish Dialog="MyExamplesDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

      <Publish Dialog="MyInfoListDlg" Control="Back" Event="NewDialog" Value="MyExamplesDirDlg">1</Publish>
      <Publish Dialog="MyInfoListDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>

      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MyExamplesDirDlg" Order="1">NOT Installed</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

      <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
    </UI>

   <UIRef Id="WixUI_Common" />
  </Fragment>
</Wix>