Arbiter
Arbiter

Reputation: 470

Wix issue inserting a custom dialog into a built-in dialog set

I have created a dialog called ApiKeyDlg which I have nested in the UI. The UI is a direct copy of the built-in WixUI_InstallDir with some minor tweaks.

I have added the dialogref and the publish elements, but for some reason the ApiKeyDlgdialog does not show. Neither candle.exe or light.exe display any errors, and the MSI file installs perfectly, just without showing my custom dialog.

There are many questions similar to this one on Stackoverflow, I have read 8 or 10 of them and haven't got any closer to answering my own. I have also read this guide (https://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html), specifically the last paragraph about "Inserting a custom dialog into a built-in dialog set" but something isn't clicking and I'm not getting any further.

The order (for an installation) should be:

  1. Welcome
  2. License
  3. ApiKey
  4. Verify
  5. Exit (complete)
<UI Id="MyWixUI_InstallDir">
    <TextStyle Id="WixUI_Font_Normal" FaceName="Calibri" Size="8" />
    <TextStyle Id="WixUI_Font_Bigger" FaceName="Calibri" Size="12" />
    <TextStyle Id="WixUI_Font_Title" FaceName="Calibri" Size="9" Bold="yes" />

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

    <Dialog Id="ApiKeyDlg" Width="370" Height="270" Title="Organisation ID required" Modeless="yes">
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUICancel)">
            <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes" Text="Please enter the ID of the organisation to which this device belongs" />
        <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="Organisation ID" />
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="!(loc.WixUIBack)" />
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" TabSkip="yes" Text="!(loc.WixUINext)" />
        <Control Id="ActionData" Type="Text" X="135" Y="125" Width="220" Height="30" Transparent="yes" NoPrefix="yes">
            <Subscribe Event="ActionData" Attribute="Text" />
        </Control>
        <Control Id="ActionText" Type="Text" X="135" Y="100" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
            <Subscribe Event="ActionText" Attribute="Text" />
        </Control>
    </Dialog>

    <DialogRef Id="ApiKeyDlg" />
    <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" />

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

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

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

    <Publish Dialog="ApiKeyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
    <Publish Dialog="ApiKeyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1<!--Some text field conditon here maybe?--></Publish>

    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ApiKeyDlg" Order="1">NOT Installed</Publish>
    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
    <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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>

    <Property Id="ARPNOMODIFY" Value="1" />
    <!--
    <InstallUISequence>
        <Show Dialog="ApiKeyDlg" Before="VerifyReadyDlg" Overridable="no" />
    </InstallUISequence>
    -->
</UI>
<UIRef Id="MyWixUI_InstallDir" />
<UIRef Id="WixUI_Common" />

Upvotes: 0

Views: 648

Answers (1)

Arbiter
Arbiter

Reputation: 470

I've just got this working. Solution was to put the custom dialog in a fragment outside of the product tag and clean up my UI references as shown below:

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

...
Lots of other stuff, removed to shrink post
...


       <UI>
            <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="DiskCostDlg" />
            <DialogRef Id="LicenseAgreementDlg" />
            <DialogRef Id="VerifyReadyDlg" />
            <DialogRef Id="ErrorDlg" />
            <DialogRef Id="FatalError" />
            <DialogRef Id="FilesInUse" />
            <DialogRef Id="MsiRMFilesInUse" />
            <DialogRef Id="PrepareDlg" />
            <DialogRef Id="ProgressDlg" />
            <DialogRef Id="ResumeDlg" />
            <DialogRef Id="UserExit" />
            <DialogRef Id="ApiKeyDlg" />

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

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

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

            <Publish Dialog="ApiKeyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
            <Publish Dialog="ApiKeyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">NOT ApiKey</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ApiKeyDlg" Order="1">NOT Installed</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</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>

            <Property Id="ARPNOMODIFY" Value="1" />
            <UIRef Id="WixUI_Common" />
        </UI>
        <Property Id="WIXUI_APIKEY" Value="APIKEY" />

    </Product>

    <Fragment>
        <UI>
            <Dialog Id="ApiKeyDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
                <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="You can find the organisation ID for this device in the dashboard." />
                <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Organisation ID required" />
                <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" />
                <Control Id="ApiKeyLabel" Type="Text" X="20" Y="60" Width="290" Height="10" NoPrefix="yes" Text="Organisation ID:" />
                <Control Id="ApiKey" Type="Edit" X="20" Y="75" Width="100" Height="18" Property="WIXUI_APIKEY" Indirect="yes" />
            </Dialog>
        </UI>
    </Fragment>

</Wix>

Upvotes: 1

Related Questions