WIX Popup dialog - wix

I have two custom dialogs - dlg1 and dlg2. After user clicks NEXT on dlg1 another custom popup dialog with some text and OK button should be shown. After user clicks OK on this popup dlg2 should appear. I've tried a lot of things but the best of it just shows dlg2 on top of dlg1 and OK-popup.

You have to create a modal dialog which passes the user from the first dialog to the second. Actually modal dialogs are used to show a message and then return focus to the dialog in which the modal dialog was called. I don't know if you are breaking any installer rules, if you don't return focus to the calling dialog but it seems to work:
Code for dlg1:
<UI>
<Dialog Id="dlg1" ...>
<Control Id="firstText" Type="Text" X="10" Y="10" Width="200" Height="17" Text="First Dialog calls Modal Dialog." />
<Control Id="PopupButton" Type="PushButton" Text="Show Popup" Height="17" Width="56" X="100" Y="243" Default="yes">
<Publish Event="SpawnDialog" Value="PopupDlg" />
</Control>
</Dialog>
</UI>
Code for PopupDlg:
<UI>
<Dialog Id="PopupDlg" ...>
<Control Id="OkButton" Type="PushButton" Text="{\Tahoma_Bold}OK" Height="17" Width="56" X="200" Y="175">
<Publish Event="NewDialog" Value="dlg2" />
</Control>
</Dialog>
</UI>
Code for dlg2:
<UI>
<Dialog id="dlg2" ...>
<Control Id="secondText" Type="Text" X="10" Y="10" Width="200" Height="17" Text="Now proceed." />
<Control Id="CancelButton" Type="PushButton" Text="Cancel" Height="17" Width="56" X="180" Y="243">
<Publish Event="EndDialog" Value="Exit" />
</Control>
</Dialog>
</UI>
UPDATE
Implementing the solution above produces some problems. There is one workaround though, but it will render your code less readable. Let me first describe the concept behind the workaround before I post some code. Basically you are going to only have two dialogs: One which triggers the popup and the popup itself. In the popup, you do not open a new window, as described above, instead you return focus to the calling dialog. Additionally you change the state of a property. The calling dialog gets updated, based upon the property that has been set by the modal dialog.
To achieve this goal, you will have to add controls for each state in the calling dialog, one for the case the property has been set and one for the case the property has not been set.
Code for callingDialog:
<UI>
<Dialog Id="callingDialog" ...>
<Control Id="BeforePopup" Type="Text" X="10" Y="10" Width="200" Height="17" Text="Here is some text." Hidden="yes">
<Condition Action="show"><![CDATA[NOT PROP_SET_BY_MODAL_DLG]]></Condition>
<Condition Action="hide"><![CDATA[PROP_SET_BY_MODAL_DLG]]></Condition>
</Control>
<Control Id="AfterPopup" Type="Text" X="10" Y="10" Width="200" Height="17" Text="Popup was shown." Hidden="yes">
<Condition Action="show"><![CDATA[PROP_SET_BY_MODAL_DLG]]></Condition>
<Condition Action="hide"><![CDATA[NOT PROP_SET_BY_MODAL_DLG]]></Condition>
</Control>
<Control Id="PopupButton" Type="PushButton" Text="Show Popup" Height="17" Width="56" X="100" Y="243" Default="yes">
<Publish Event="SpawnDialog" Value="PopupDlg" />
</Control>
</Dialog>
</UI>
Code for PopupDlg:
<UI>
<Dialog Id="PopupDlg" ...>
<Control Id="OkButton" Type="PushButton" Text="OK" Height="17" Width="56" X="200" Y="175">
<Publish Property="PROP_SET_BY_MODAL_DLG" Value="1" Order="1">1</Publish>
<Publish Event="EndDialog" Value="Return" Order="2">1</Publish>
</Control>
</Dialog>
</UI>

Found one more solution for this. It's to use WinForms dialogs from a custom action.
When user clicks NEXT button custom action is invoked:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="DoAction" Value="SomeAction">1</Publish>
</Control>
In this custom action you can call WinForm dialog. And don't forget to set the check for the silent install mode to make sure that the dialog will not be showed during silent install:
[CustomAction]
public static ActionResult SomeAction(Session session)
{
if(Int32.Parse(session["UILevel"]) > 3)
{
var result = MessageBox.Show("Do something?", "Popup dialog", MessageBoxButtons.YesNo);
session["SOMEPROP"] = result == DialogResult.Yes ? "True" : "False";
}
return ActionResult.Success;
}

Related

Wix Custom Action Property Not Immediately Available

I have a Wix VBScript Custom Action that sets a Property, and then a publish event that is supposed to trigger based on the value of the set property. The issue seems to be that the property is not being set and in turn not triggering the next publish event. Has anyone successfully done something similar?
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:hsi="http://schemas.hyland.com/wix/UtilityExtension">
<Fragment>
<Property Id="FOO" Value="0" Secure="yes" />
<CustomAction Id="Test3" Script="vbscript">
<![CDATA[
MsgBox Session.Property("FOO")
]]>
</CustomAction>
<CustomAction Id="Test2" Script="vbscript">
<![CDATA[
MsgBox "Test"
]]>
</CustomAction>
<CustomAction Id="Test1" Script="vbscript">
<![CDATA[
Session.Property("FOO") = "1"
]]>
</CustomAction>
</Fragment>
<Fragment>
<UI>
<DialogRef Id="WarningModalDlg"/>
<Dialog Id="BaseLawsonWebServerDlg" Width="370" Height="270" Title="Lawson LOB Broker Relay Setup">
<Control Id="label" Type="Text" X="20" Y="50" Width="200" Height="16" Text="Test" TabSkip="yes" Transparent="yes" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Order="1" Event="DoAction" Value="Test3">1</Publish>
<Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish>
<Publish Order="3" Event="DoAction" Value="Test1">1</Publish>
</Control>
<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>
</Dialog>
</UI>
</Fragment>
</Wix>
Event="DoAction" Value="Test1" fires, I've tested it. Event="DoAction" Value="Test2">FOO = "1" does not hit. Then Event="DoAction" Value="Test3">1</Publish> definitely hits and shows the message box with the default value.
Thanks ahead of time!
I figured it out! I was so used to the reverse order of UI Dialog Publish events that I did the same thing for Control publish events.
Control Publish events move in the the order of 1 to x.
The publish events should look like this instead:
<Publish Order="1" Event="DoAction" Value="Test1">1</Publish>
<Publish Order="2" Event="DoAction" Value="Test2">FOO = "1"</Publish>
<Publish Order="3" Event="DoAction" Value="Test3">1</Publish>

wix set install location variable from radio button

I'm trying to set two different install locations using radio buttons (single user installs to AppData and allusers installs to ProgramFiles)
My property is defined as follows:
<Property Id="INSTALLSCOPE" Secure="yes" />
My install directory definitions are as follows:
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id= 'INSTALLSCOPE' Name='AppData'>
<Directory Id='MYAPP' Name='COMPANY'>
<Directory Id='INSTALLDIR' Name='MyApp'>
My radio buttons are as follows:
<Dialog Id="CustomInstallScopeDlg" Width="370" Height="270" Title="[ProductName] Install Scope"
NoMinimize="yes">
<Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property="INSTALLSCOPE">
<RadioButtonGroup Property="INSTALLSCOPE">
<RadioButton Value="LocalAppDataFolder" X="0" Y="0" Width="300" Height="10" Text="SingleUser"/>
<RadioButton Value="ProgramFilesFolder" X="0" Y="20" Width="300" Height="10" Text="AllUser"/>
</RadioButtonGroup>
</Control>
...
After the radio buttons are changed and NEXT button is clicked, the following happens:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes"
Text="[ButtonText_Next]">
<Publish Property="INSTALLSCOPE" Value="LocalAppDataFolder">INSTALLSCOPE = "LocalAppDataFolder"</Publish>
<Publish Property="INSTALLSCOPE" Value="ProgramFilesFolder">INSTALLSCOPE = "ProgramFilesFolder"</Publish>
</Control>
Currently whats happening when I run it is it tries to install in E:AppData, instead of the correct AppData folder. Also the installer bugs out and the UI doesnt show. This doesnt happen if I hardcode the value LocalAppDataFolder instead of passing it through a variable. I ran a log on the install process and I can see the value of INSTALLSCOPE being changed as I go through the installer but the UI never updates to reflect this change and neither does the actual installation path ever change. Any help would be great.
Add a SetTargetPath event:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes"
Text="[ButtonText_Next]">
<Publish Property="INSTALLSCOPE" Value="LocalAppDataFolder">INSTALLSCOPE = "LocalAppDataFolder"</Publish>
<Publish Property="INSTALLSCOPE" Value="ProgramFilesFolder">INSTALLSCOPE = "ProgramFilesFolder"</Publish>
<Publish Event="SetTargetPath" Value="INSTALLSCOPE">1</Publish>
</Control>

Stop setup error inside Custom Action With WIX installer

Can i able to stop the setup if any error display inside CustomAction. As i can able display error message inside custom Action and it's dispaly the error message but as soon as i click on ok button my next UI sequence form is appearing.How i will force user to finish button?
Adding my source code:
<Binary Id="BIN_CustomAction" SourceFile="CustomAction.CA.dll" />
<CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" DllEntry="CA_CheckList" Execute="immediate" Impersonate="yes" Return="ignore" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="UserRegistrationDlg" />
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="ComboBoxMain" Type="ComboBox" X="124" Y="158" Width="241" Height="16" Property="LOCATIONNAME">
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="SpawnDialog" Value="SetupTypeDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
<Control Id="Next" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&NExt">
<Publish Event="DoAction" Value="RadioButtonCheck">1</Publish>
</Control>
</Dialog>-->
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="UserRegistrationDlg" Order="3">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="UserRegistrationDlg">1</Publish>
</UI>
<InstallUISequence>
<Custom Action="CA_CheckList" Before="AppSearch">Not Installed</Custom>
</InstallUISequence>
[CustomAction]
public static ActionResult CA_CheckList(Session session)
{
if (installer.ListStatus == false)
{
// dispaly
Record record = new Record();
record.FormatString = string.Format("Error!");
session.Message(
InstallMessage.Error | (InstallMessage)(MessageIcon.Error) |
(InstallMessage)MessageButtons.OK,record);
return ActionResult.Failure;
}
else
{
return ActionResult.Success;
}
}
Add screen shot also proving once i click on Ok button of image(1) my next dialog i.e image (2) is appearing:- instead of what i need is Finish dialog when i am getting the error.
1)
2)
Any idea??kindly help me.
This is an old post but I'd like to answer the question in case somebody else finds this. In the custom action definition, CustomAction Id="CA_CheckList" BinaryKey="BIN_CustomAction" ..., 'Return' is set to 'ignore'. It should be set to 'check'.
It's all about returning the correct "error code" from the custom action. If you want to terminate the installation, return ActionResult.Failure from your CA.
Side note: displaying UI from inside the custom action is generally a bad idea - this scenario doesn't support silent installation the way it should go.

Use WiX browser dialog to set edit box value

I'm trying to create a WiX installer dialog that provides a series of textboxes that users need to fill in with directory locations.
What I would like to do is put a Browse button next to each dialog and when they click it, the WiX Browse dialog will come up, they select a file location, click OK, and the text box next to the browse button will be filled in.
I know how to do it with a custom action, but I was wondering if there was a pure WiX way of doing this.
EDIT: I should be more clear. I meant directory locations, not file locations. Wix doesn't have file browsing support as one user indicated below.
I found a way to do it completely in WiX. WiX comes with a browse dialog called BrowseDlg. Here's what I did:
I created a dialog that includes a PathEdit control and PushButton control. Notice that the PathEdit control has the Indirect property set to yes. This means that whatever you set Property to is just a pointer to something else.
<Dialog Id="BackupConfigDlg" Width="370" Height="270" Title="Backup Configuration">
<Control Type="Text" Id="lblInstructions" Width="348" Height="13" X="10" Y="10">
<Text>{\WixUI_Font_Title}Please select the directory you want to backup.</Text>
</Control>
<Control Type="Text" Id="lblBackupDirectory" Width="69" Height="9" X="10" Y="40" Text="Backup directory:">
</Control>
<Control Type="PathEdit" Id="Folder" Width="219" Height="15" X="82" Y="38" Property="_BrowseProperty" Indirect="yes" />
<Control Type="PushButton" Id="Browse" Width="56" Height="17" X="304" Y="37" Text="Browse..." />
<Control Type="Line" Id="line" Width="362" Height="2" X="4" Y="229" />
<Control Id="Cancel" Type="PushButton" X="239" Y="240" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Type="PushButton" Id="Install" Width="56" Height="17" X="300" Y="240" Text="Install">
<Publish Event="EndDialog" Value="Return" />
</Control>
</Dialog>
The browse dialog (that we'll eventually get to) expects to set an object in the Directory table, so we need to create a Directory object that will only be used to hold the value we browse to. Since we won't put any components in it, nothing on the file system will change relating to the directory we choose. I call mine TARGETBACKUPDIRECTORY.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="TARGETBACKUPDIRECTORY">
</Directory>
...
</Directory>
Now we need to create a property that points to the Directory object.
<Property Id="BACKUPDIRECTORY" Value="TARGETBACKUPDIRECTORY" />
We now need to make sure that the _BrowserProperty property is properly bound to BACKUPDIRECTORY (because it points to the Directory object we want set) before this dialog opens. If you don't, you will get an error during the install process when you attempt to open the dialog. In my example, PrevDlg is a dialog that appears before BackupConfigDlg. What's happening here is that when the Next button is pushed, I set the _BrowserProperty property to BACKUPDIRECTORY, I then open the dialog. It must take place in that order so I use the Order property to enforce it. I do the same thing when the browse button is pushed, not sure I need to do, but I do it just for safe measure.
<Publish Dialog="PrevDlg" Control="Next" Property="_BrowseProperty" Value="[BACKUPDIRECTORY]" Order="1">1</Publish>
<Publish Dialog="PrevDlg" Control="Next" Event="NewDialog" Value="BackupConfigDlg" Order="2">1</Publish>
<Publish Dialog="BackupConfigDlg" Control="Browse" Property="_BrowseProperty" Value="[BACKUPDIRECTORY]" Order="1">
</Publish>
<Publish Dialog="BackupConfigDlg" Control="Browse" Event="SpawnDialog" Value="BrowseDlg" Order="2">
</Publish>
That's what worked for me.
The selected answer to this question is way too much work. You don't need to do all that.
Set your PathEdit control to the directory to configure as you normally would. Then, in the actions of the browse button, set _BrowseProperty to the NAME (not value of) of your property to configure and then SpawnDialog. That's it.
<Control Type="PathEdit"
Id="TxtDir"
Width="155" Height="15"
X="105" Y="57"
Property="OUTPUTDIRECTORY"/>
<Control Id="btnDirBrowse"
Type="PushButton"
Width="56" Height="17"
X="260" Y="57"
Text="Browse..." >
<Publish Property="_BrowseProperty" Value="OUTPUTDIRECTORY" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</Control>
In order to have multiple directories (filled by the BrowseDlg) in the same dialog window, an extra indirection is required. Notice also the numbering within the <Publish></Publish> tags :
<Control Id="WorkingDirFolderLabel" Type="Text" Width="220" Height="12" X="10" Y="50" Text="Working directory:"/>
<Control Id="WorkingDirFolder" Type="PathEdit" Width="250" Height="17" X="10" Y="62" Property="_WorkingDirBrowseProperty" Indirect="yes"/>
<Control Id="WorkingDirBrowse" Type="PushButton" Width="56" Height="17" X="265" Y="62" Text="Browse..." >
<Publish Property="_BrowseProperty" Value="[_WorkingDirBrowseProperty]" Order="2">1</Publish>
<Publish Event="SpawnDialog" Value="BrowseDlg" Order="3">1</Publish>
</Control>
<Control Id="DocsDirFolderLabel" Type="Text" Width="220" Height="12" X="10" Y="100" Text="Documentation area:"/>
<Control Id="DocsDirFolder" Type="PathEdit" Width="250" Height="17" X="10" Y="112" Property="_DocsDirBrowseProperty" Indirect="yes" />
<Control Id="DocsDirBrowse" Type="PushButton" Width="56" Height="17" X="265" Y="112" Text="Browse..." >
<Publish Property="_BrowseProperty" Value="[_DocsDirBrowseProperty]" Order="2">2</Publish>
<Publish Event="SpawnDialog" Value="BrowseDlg" Order="3">2</Publish>
</Control>
Then pass the references as before (no need to define extra properties) :
<Publish Dialog="PrevDlg" Control="Next" Property="_WorkingDirBrowseProperty" Value="TARGETWORKINGDIRECTORY" Order="1">1</Publish>
<Publish Dialog="PrevDlg" Control="Next" Property="_DocsDirBrowseProperty" Value="TARGETDOCSDIRECTORY" Order="1">1</Publish>
<Publish Dialog="PrevDlg" Control="Next" Event="NewDialog" Value="BackupConfigDlg" Order="2">1</Publish>
Windows Installer doesn't support file browsing, so there is no direct support for this in WiX. The best solution is still a custom action executed when clicking browse button.
You can find a sample custom action here: http://www.installsite.org/pages/en/msi/ca.htm
None of the above or anywhere else worked for me. What did work is so more simple and straight forward.
Like many, I need to prompt the Installer user for the target locations of SQL Server .mdf and .ldf files, which will likely reside outside of any pre-installation Directory structure. In fact, my preceding Dialog prompts the user for the target database server. Given that, I then custom act on that preceding Dialog's "Next" button to (a) find the mdf & ldf paths of the server's "master" database and then (b) default the new database's respective paths to those of the master db.
But hours of frustration making PathEdit play nice with BrowseDlg proved futile. What I ended up doing was creating a placeholder Property called PATH_TEMP_BROWSE. It is the "SetTarget" call in the BrowseDlg that forces us to enlist the Wix Directory tree. Get rid of that line in your own custom rip-off of BrowseDlg and instead pass around the user's selected directory via PATH_TEMP_BROWSE thusly:
<Dialog Id="DirectoryBrowserDlg" Width="370" Height="270" Title="Dir Browse">
<Control Id="Path" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="PATH_TEMP_BROWSE" Indirect="yes" />
<Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
<!-- NO! -->
<!--<Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</Publish>-->
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
...
<Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="PATH_TEMP_BROWSE" Indirect="yes" Fixed="yes" Remote="yes">
<Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
</Control>
...
<Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="98" Property="PATH_TEMP_BROWSE" Sunken="yes" Indirect="yes" TabSkip="no" />
...
</Dialog>
Then, to make use of my pop-up modal DirectoryBrowserDlg within my installation Dialog that prompts the user for the new database name as well as its logical files...
<Control Id="MdfPath"
Type="PathEdit"
X="37"
Y="184"
Width="313"
Height="18"
Property="PATH_DBMDFCS"
/>
<Control Id="MdfBrowse"
Type="PushButton"
X="350"
Y="184"
Width="22"
Height="17"
Text="Browse..."
>
<Publish Property="PATH_TEMP_BROWSE" Value="PATH_DBMDFCS" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="DirectoryBrowserDlg" Order="2">1</Publish>
<Publish Property="PATH_DBMDFCS" Value="PATH_TEMP_BROWSE" Order="3" />
</Control>
Do the same for your .ldf file.
K.I.S.S
I have a very easy solution. We can use the ConfigurableDirectory attribute of feature to enable the browse directory. It works well for me.
<Feature Id="OCMSnapshotConfigAppFeature" Title="OCM Snapshot Configuration" Level="1" ConfigurableDirectory="INSTALLDIR">

WIX UI - Creating a "passwords don't match" label

I need my installer to accept a password, and so I've created a dialog on which users are prompted to enter their passwords twice (to avoid mistakes), however I'm having some trouble getting my "Your passwords don't match" label to appear and disappear at the correct times.
This is what I have so far:
<Control Id="Password" Type="Edit" Property="VDIR_PASSWORD" Password="yes" />
<Control Id="ConfirmPassword" Type="Edit" Property="ConfirmPassword" Password="yes" />
<Control Id="PasswordMismatchLabel" Type="Text" Text="Passwords do not match.">
<Condition Action="hide">VDIR_PASSWORD = ConfirmPassword</Condition>
</Control>
This compiles, however does the label never shows. (if I reverse the condition then the label shows, but doesn't disappear if they don't match).
I can see that the thing I'm missing is subscription to some event that updates the label whenever something happens (e.g. the user presses a key, or focus is lost from either of the controls), however I'm not able to find any documentation or examples of how I might achieve this.
Is it possible to do this?
Here is an example of what Yan is suggesting:
<Control Id="Next" Type="PushButton" X="238" Y="243" Width="56" Height="17" Text="Next">
<Publish Event="NewDialog" Value="VirtualDirectoryDlg">1</Publish>
<Condition Action="disable">
<![CDATA[(ACCOUNT_TYPE = "Service" AND WEB_APP_POOL_SERVICE_NAME = "") OR
(ACCOUNT_TYPE = "User" AND
((WEB_APP_POOL_IDENTITY_DOMAIN = "" OR
WEB_APP_POOL_IDENTITY_NAME = "" OR
WEB_APP_POOL_IDENTITY_PWD = "" OR
WEB_APP_POOL_IDENTITY_PWD_CONFIRM = "") OR (WEB_APP_POOL_IDENTITY_PWD <> WEB_APP_POOL_IDENTITY_PWD_CONFIRM))) ]]>
</Condition>
<Condition Action="enable">
<![CDATA[(ACCOUNT_TYPE = "Service" AND WEB_APP_POOL_SERVICE_NAME <> "") OR
(ACCOUNT_TYPE = "User" AND
((WEB_APP_POOL_IDENTITY_DOMAIN <> "" AND
WEB_APP_POOL_IDENTITY_NAME <> "" AND
WEB_APP_POOL_IDENTITY_PWD <> "" AND
WEB_APP_POOL_IDENTITY_PWD_CONFIRM <> "") AND (WEB_APP_POOL_IDENTITY_PWD = WEB_APP_POOL_IDENTITY_PWD_CONFIRM))) ]]>
</Condition>
</Control>
Here's the approach I took to solve this issue. This solution does not rely on disabling the "Next" button. Instead, it recognizes three states during the password comparison, but doesn't allow a user to proceed unless 1) both the password fields are populated, and 2) both password fields match. This solution also provides text labels to let the user better understand when there are errors states.
Hopefully this solution will help others.
The three states:
Passwords match
Passwords do not match
Passwords match, but are empty strings
Error states:
"Passwords do not match"
"Password fields required"
To get the red, slightly larger than normal text, by adding the following TextStyle element into my primary wxs file (e.g. product.wxs).
<UI>
<TextStyle Id="WixUI_Font_Large_Red" FaceName="Tahoma" Size="9" Red="255" />
</UI>
Here's the
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Property Id="PASSWORD_COMPARE" Value="1" />
<UI>
<Dialog Id="ConfirmPasswordDlg" Width="370" Height="270" Title="Confirm Password Demo">
<Control Id="PasswdLabel" Type="Text" X="25" Y="65" Width="90" Height="15" TabSkip="no" Text="Password:" RightAligned="yes" />
<Control Id="PasswdEdit" Type="Edit" X="117" Y="62" Width="175" Height="16" Property="PASSWD" Text="{80}" Password="yes"></Control>
<Control Id="ConfirmPasswdLabel" Type="Text" X="25" Y="90" Width="90" Height="15" TabSkip="no" Text="Confirm Password:" RightAligned="yes" />
<Control Id="ConfirmPasswdEdit" Type="Edit" X="117" Y="87" Width="175" Height="16" Property="PASSWD_CONFIRM" Text="{80}" Password="yes"></Control>
<Control Id="PasswordsMatchLabel" Type="Text" X="150" Y="110" Width="140" Height="18" Text="{\WixUI_Font_Large_Red}Passwords do not match">
<Condition Action="hide">(PASSWORD_COMPARE = "1")</Condition>
<Condition Action="show">(PASSWORD_COMPARE = "2")</Condition>
<Condition Action="hide">(PASSWORD_COMPARE = "3")</Condition>
</Control>
<Control Id="PasswordsRequiredLabel" Type="Text" X="150" Y="110" Width="140" Height="18" Text="{\WixUI_Font_Large_Red}Password fields required">
<Condition Action="hide">(PASSWORD_COMPARE = "1")</Condition>
<Condition Action="hide">(PASSWORD_COMPARE = "2")</Condition>
<Condition Action="show">(PASSWORD_COMPARE = "3")</Condition>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back"></Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
<Publish Property="PASSWORD_COMPARE" Value="1" Order="1">
<![CDATA[ (PASSWD = PASSWD_CONFIRM) ]]>
</Publish>
<Publish Property="PASSWORD_COMPARE" Value="2" Order="2">
<![CDATA[ (PASSWD <> PASSWD_CONFIRM) ]]>
</Publish>
<Publish Property="PASSWORD_COMPARE" Value="3" Order="3">
<![CDATA[ (PASSWD = "" AND PASSWD_CONFIRM = "") ]]>
</Publish>
<Publish Event="NewDialog" Value="VerifyReadyDlg" Order="4">PASSWORD_COMPARE = "1"</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
WiX can only do what underlying technology (Windows Installer) can. Windows Installer has poor UI comparing to usual desktop applications we all used to. So, answering your question: no, you can't show/hide the label based on the value you've typed into the password field. At least, I'm not aware about a supported way.
However, you can do the following. Drop that label, and instead add a condition to the Next button of this dialog. If passwords match, move to the next dialog in the chain. Otherwise, show a message box saying "password don't match" and stay on the current dialog until the user fills it in correctly.
Hope this helps.
As far as I'm aware, there is no event subscription model in Wix. What you'll likely have to do is create a custom action to verify that the passwords match and have that control the label. This may help also.