WiX - how do I refresh Edit control after file browse dialog - wix

I am required to have a FileBrowseDialog during a WiX installation. I made my own custom dialog that raises the OpenFileDialog and sets the selected value in the session property (found the code here). I need a way to refresh the Edit control with the selected full path. Right now, after choosing the file, the edit control remains blank. How do I achieve this? I am not an expert in MSI or WiX.
Wix Code:
<UI>
<Dialog Id="DrugsDBFileBrowseDialog" Width="370" Height="270" Title="!(loc.DrugsDBFileDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.SetupTypeDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgTitle)" />
<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="DoAction" Value="BrowseDBFile" Order="0">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" />
<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>
Custom Action Code:
[CustomAction]
public static ActionResult BrowseDBFile(Session session)
{
try {
session.Log("Begin OpenFileChooser Custom Action");
var task = new Thread(() => GetFile(session));
task.SetApartmentState(ApartmentState.STA);
task.Start();
task.Join();
session.Log("End OpenFileChooser Custom Action");
} catch (Exception ex) {
session.Log("Exception occurred as Message: {0}\r\n StackTrace: {1}", ex.Message, ex.StackTrace);
return ActionResult.Failure;
}
return ActionResult.Success;
}
private static void GetFile(Session session)
{
OpenFileDialog fileDialog = new OpenFileDialog();
if (fileDialog.ShowDialog() == DialogResult.OK) {
session["DRUGSDBFILEPATH"] = fileDialog.FileName;
}
}
UPDATE
Found out the solution is to invoke the RESET event before performing the action associated to the BROWSE button. I also performed a PUBLISH PROPERTY after performing the custom action. Look below.
<UI>
<Dialog Id="DrugsDBFileBrowseDialog" Width="370" Height="270" Title="!(loc.DrugsDBFileDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.SetupTypeDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgTitle)" />
<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="Reset" Value="1">1</Publish>
<Publish Event="DoAction" Value="BrowseDBFile" Order="1"><![CDATA[1]]></Publish>
<Publish Property="DRUGSDBFILEPATH" Value="[DRUGSDBFILEPATH]"><![CDATA[1]]></Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" >
<Publish Event="DoAction" Value="ValidateSelectedPath" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</Control>
<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>

<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="Reset" Value="1">1</Publish>
<Publish Event="DoAction" Value="BrowseDBFile" Order="1"><![CDATA[1]]></Publish>
<Publish Property="DRUGSDBFILEPATH" Value="[DRUGSDBFILEPATH]"><![CDATA[1]]></Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" >
<Publish Event="DoAction" Value="ValidateSelectedPath" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</Control>
<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>

I did the same with the label
<Control
Type="PushButton"
Id="Browse"
Width="56"
Height="17"
X="281"
Y="125"
Text="Browser"
Property="FILE_PATH" >
<Publish Event="DoAction" Value="CA_TO_OPEN_FILE_BROWSER_DIALOG" Order="1">1</Publish>
<Publish Property="FILE_PATH" Value="[FILE_PATH]">1</Publish>
</Control>
<Control
Type="Text"
Id="LocationLabel"
Width="244"
Height="15"
X="26" Y="126"
Property="FILE_PATH"
Text="[FILE_PATH]"
Sunken="yes"
Indirect="yes"
Disabled="yes">
</Control>

Related

Back/Next Button in UI using Wix toolset

I can not make adequate buttons to move normally between windows.
My installer contains 3 windows. If I do "NewDialog" in "Back-button", the windows open once again. And if I do "EndDialog"- the windows disappear.
<UI Id="UserInterface">
<Property Id="WixUI_Mode" Value="Custom" />
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="9" Bold="yes" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Dialog Id="IISSettings" Width="250" Height="160" Title="IIS Settings">
<Control Type="Text" Id="HostNameEditLabel" X="10" Y="10" Width="200" Height="15" Text="Hostname" />
<Control Type="Edit" Id="HostNameEdit" X="10" Y="30" Width="118" Height="15" Property="HOSTNAME" Text="{80}" Indirect="no" />
<Control Type="PushButton" Id="BrowseLicenseFile" X="165" Y="70" Width="75" Height="15" Text="Browse...">
<Publish Event="DoAction" Value="BrowseForCertificateFileCA" Order="1"><![CDATA[1]]></Publish>
<Publish Property="CERTPATH" Value="[CERTPATH]"><![CDATA[1]]></Publish>
</Control>
<Control Type="Text" Id="PasswordLabel" X="10" Y="90" Width="82" Height="15" Text="Сertificate password" />
<Control Type="Edit" Password="yes" Id="CertificatePassword" X="10" Y="105" Width="123" Height="15" Property="PASSCERT" />
<Control Type="PushButton" Id="Next" X="184" Y="130" Width="56" Height="15" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="EndDialog" Value="Return"></Publish>
</Control>
<Control Type="PushButton" Id="Cancel" X="120" Y="130" Width="56" Height="15" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">
</Publish>
</Control>
</Dialog>
<Dialog Id="PortControlUserService" Width="370" Height="200" Title="Settings">
<Control Id="InfoText" Type="Text" X="10" Y="10" Width="350" Height="15" Text="*У пользователя должны быть права администратора на клиентских компьютерах!" />
<Control Id="DbServerNameEditLabel" Type="Text" X="10" Y="35" Width="350" Height="15" Text="User login" />
<Control Id="DbServerNameEdit" Type="Edit" X="10" Y="50" Width="350" Height="18" Property="USERLOGIN" Text="{80}" Indirect="no" />
<Control Id="PasswordEditLabel" Type="Text" X="10" Y="85" Width="350" Height="15" Text="User Password" />
<Control Id="PasswordEdit" Type="Edit" Password="yes" X="10" Y="100" Width="350" Height="18" Property="USERPASSWORD" Text="{80}" Indirect="no" />
<Control Id="Back" Type="PushButton" X="156" Y="130" Width="56" Height="17" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="IISSettings"></Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="130" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="EndDialog" Value="Return"></Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="130" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg"></Publish>
</Control>
</Dialog>
<Dialog Id="PortControlParams" Width="370" Height="350" Title="Settings">
<Control Id="DbServerNameEditLabel" Type="Text" X="10" Y="10" Width="350" Height="15" Text="Database Server Name" />
<Control Id="DbServerNameEdit" Type="Edit" X="10" Y="35" Width="350" Height="18" Property="DBSERVERNAME" Text="{80}" Indirect="no" />
<Control Id="DbInstanceNameEditLabel" Type="Text" X="10" Y="60" Width="350" Height="15" Text="Database Instance Name" />
<Control Id="DbInstanceNameEdit" Type="Edit" X="10" Y="85" Width="350" Height="18" Property="DBINSTANCENAME" Text="{80}" Indirect="no" />
<Control Id="PasswordEdit" Type="Edit" Password="yes" X="10" Y="235" Width="350" Height="18" Property="DBPASSWORD" Text="{80}" Indirect="no" />
<Control Id="Back" Type="PushButton" X="156" Y="273" Width="56" Height="17" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="PortControlUserService"></Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="273" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="EndDialog" Value="Return"></Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="273" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg"></Publish>
</Control>
</Dialog>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<InstallUISequence>
<Show Dialog="IISSettings" Before="PortControlUserService" ></Show>
<Show Dialog="PortControlUserService" Before="PortControlParams" ></Show>
<Show Dialog="PortControlParams" Before="ExecuteAction" ></Show>
</InstallUISequence>
</UI>
if I add "SpawnDialog" in "Back button", the windows will appear on top of another window, and I need to have one window. Looked at a lot of forums, but it's hard.
Dialog Order: Please see if this is helpful: Wix, custom dialog when previous version exists.
Dialog Customization: There is this answer on the overall topic of Customizing WiX Dialogs. Perhaps also see Helge Klein's real world sample (Wayback - Archived Version) for dialog changes (ServerDlg.wxs, WixUI_HK.wxs, LicenseAgreementDlg_HK.wxs) and many other nice features. Customizing Built-in WixUI Dialog Sets.
And throwing in this "general WiX quick start tips".

Wix SetProperty by feature select | Launch specific feature after installation

My WixInstaller is installing two different Apps (Editor AND / OR Viewer).
After the Installation the user can check a checkbox for if he wants to launch the application.
By default, the WixShellExecTargetProperty has the value [#ViewerApp]. If the user has installed the Editor, the Property should have the value [#EditorApp]. But it is not assigned.
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<SetProperty Id="WixShellExecTarget" Value="[#EditorApp]" After="InstallExecute" Sequence="execute"><![CDATA[EditorFeature=3]]></SetProperty>
<Property Id="WixShellExecTarget" Value="[#ViewerApp]" />
Solution:
Here is my solution that works:
define the CustomAction for each apllication / feature that can/should be started.
<CustomAction Id="SetLaunchApplicationEditor" Property="WixShellExecTarget" Value="[#EditorApp]" />
<CustomAction Id="SetLaunchApplicationViewer" Property="WixShellExecTarget" Value="[#ViewerApp]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
on the last page, where the install is finished, define the start
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
<Publish Event="EndDialog" Value="Return">1</Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationViewer"><![CDATA[&ViewerFeature=3]]></Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationEditor"><![CDATA[&EditorFeature=3]]></Publish>
<Publish Event="DoAction" Value="LaunchApplication">LaunchApp = 1</Publish>
</Control>
!!
If only the Viewer or Editor is installed, then this app is started. If both are installed, the Editor gets started, because it's DoAction is triggered afterwards.
Exit Dialog with the checkbox
<Dialog Id="HtExitDialog" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
<Publish Event="EndDialog" Value="Return">1</Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationViewer"><![CDATA[&ViewerFeature=3]]></Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationEditor"><![CDATA[&EditorFeature=3]]></Publish>
<Publish Event="DoAction" Value="LaunchApplication">LaunchApp = 1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Cancel]" />
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
<Text>Click the Finish button to exit the [Wizard].</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
<Text>{\VerdanaBold13}Completing the [ProductName] [Wizard]</Text>
</Control>
<Control Type="CheckBox" Id="StartApp" Width="142" Height="17" X="158" Y="120" Text="Launch Application" Property="LaunchApp" CheckBoxValue="1" />
</Dialog>

Wix Installer - Add custom dialog to WixUI_Minimal

Please note - I don't want to change anything in WixUI_Minimal(if possible).
I am trying to add a custom dialog(UserTypeDlg) after WelcomeEulaDlg in WixUI_Minimal i.e whenever a user clicks on Install button after accepting license. This part works fine
On custom dialog I have provided back button which works just fine and takes me to WelcomeEulaDlg. However, when I again click on Install button it directly start installation with out showing my custom dialog.
Could someone help me to get around this?
My code is -
Custom dialog
-->
<Dialog Id="UserTypeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<!--<Control Id="InstallButton" Type="PushButton" Text="Install" Height="17" Width="56" X="245" Y="243">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="UserTypeRadioGroup" Type="RadioButtonGroup" Property="UserTypeRadioButtonGroup" Height="100" Width="100" X="50" Y="50">
<RadioButtonGroup Property="UserTypeRadioButtonGroup">
<RadioButton Value="1" Text="Admin" Height="17" Width="50" X="50" Y="0" />
<RadioButton Value="2" Text="Domain User" Height="17" Width="100" X="50" Y="20" />
</RadioButtonGroup>
</Control>
<!--<Control Id="Next" Type="PushButton" X="245" Y="243" Width="100" Height="17" Text="Next">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
<Publish Property="WixUI_InstallMode" Value="Update">Installed AND PATCH</Publish>
</Control>
<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="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />-->
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="WelcomeEulaDlg">1</Publish>
</Control>
</Dialog>
<!--<Dialog Id="AdminDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="no">
</Dialog>-->
</UI>
</Fragment>
</Wix>
Product installation file:-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="UserTypeUI">
<Property Id="UserTypeRadioButtonGroup" Value="2" />
<!--<TextStyle Id="Tahoma_Regular" FaceName="Tahoma" Size="8" />
<Property Id="DefaultUIFont" Value="Tahoma_Regular"/>-->
<Dialog Id="UserTypeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<!--<Control Id="InstallButton" Type="PushButton" Text="Install" Height="17" Width="56" X="245" Y="243">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="UserTypeRadioGroup" Type="RadioButtonGroup" Property="UserTypeRadioButtonGroup" Height="100" Width="100" X="50" Y="50">
<RadioButtonGroup Property="UserTypeRadioButtonGroup">
<RadioButton Value="1" Text="Admin" Height="17" Width="50" X="50" Y="0" />
<RadioButton Value="2" Text="Domain User" Height="17" Width="100" X="50" Y="20" />
</RadioButtonGroup>
</Control>
<!--<Control Id="Next" Type="PushButton" X="245" Y="243" Width="100" Height="17" Text="Next">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
<Publish Property="WixUI_InstallMode" Value="Update">Installed AND PATCH</Publish>
</Control>
<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="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />-->
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="WelcomeEulaDlg">1</Publish>
</Control>
</Dialog>
<!--<Dialog Id="AdminDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="no">
</Dialog>-->
</UI>
</Fragment>
</Wix>
According to the wix documentation you still need to change the '' elements of what you want to change, setting the 'Next Event' and 'Back Event' of your dialog and overwriting the events of elements that should come before and after your dialog

WIX installer - Installing Features based on checkbox selection in UI dialog is not working

Even though Checkbox is not selected, the msi installs all features. I have AddLocal and remove when Next is clicked. Here is the UI code:
<Control Id="SFCheckBox" Type="CheckBox" X="20" Y="80" Width="290" Height="17" Property="SF_FEATURE" CheckBoxValue="0" Integer="yes" Text="iNetSec Smart Finder Sensor Service will be installed." Default="yes" Disabled="yes" />
<Control Id="group_NDCforFEService" Type="CheckBox" X="20" Y="110" Width="290" Height="17" Property="FE_FEATURE" CheckBoxValue="1" Integer="yes" Text="iNetSec Smart Finder FireEye Integration Service will be installed." />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="DoAction" Value="CostFinalize">1</Publish>
<Publish Event="NewDialog" Value="UserInfoDlg" Order="2">SF_FEATURE</Publish>
<Publish Event="AddLocal" Value="All" Order="3">1</Publish>
<Publish Event="Remove" Value="IntegrationFeatures" Order="4">NOT FE_FEATURE</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
<Publish Event="AddLocal" Value="All" Order="3">1</Publish>
<Publish Event="NewDialog" Value="InstallDirDlg" Order="4">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>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="iNetSec Smart Finder Features." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}iNetSec Smart Finder Features" />
<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" />
</Dialog>
</UI>
The Features in Product is as follows.
I don't know what I am I doing wrong here. Even though I did not select the second checkbox, the "IntegrationFeatures" was installed. When I checked the log file, I see this:
Property(S): ADDLOCAL = IntegrationFeatures,ProductFeature.
Please help.
Thanks,
Ravi
I do not recommend the AddLocal and Remove approach found here for the reasons I listed in the comments which amount to "Install everything and then removing it based on checkbox selection is silly and complicates silent installs".
What you should be doing is adding conditions to your <Feature> nodes like this:
<Feature Id="FeatureA" Level="0">
<Condition Level="1">INSTALLFEATUREA</Condition>
<ComponentGroupRef Id="A_Files" />
</Feature>

Wix: How to add browse button in Wix

Is there a simple way to add browse button in Wix. I created a custom by modifying from WixUI_InstallDir.wxs. This browse button is in another dialog (not the same one as for locating the installation path). This browse button will be use to specify the path to put my log files that will be created during installation.
EDIT:
sorry about the confusion on "below code". I intended to show the codes initially but the space on the above reply was limited. Here I've added the codes. I manage to show the Browse dialog now but i need to be able to change the path so that it is not same as the Browse dialog path of the installation path which is _BrowseProperty. My code below is using _LogBrowseProperty but i'm not sure how do i properly define it and at where should i define it. Using the code below will generate 2819 error. Can you help to take a look on what is wrong here? Thanks a lot.
CUSTOMDIR is defined in Product.wxs
<Property Id='CUSTOMDIR' Value="TARGETDIR"></Property>
Below is in MyWixUI_InstallDir.wxs
<Control Id="LogFolderLabel" Type="Text" X="20" Y="160" Width="290" Height="30" NoPrefix="yes"
Text="Folder Label" />
<Control Id="LogFolder" Type="PathEdit" X="20" Y="200" Width="320" Height="18" Property="CUSTOMDIR"
Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="220" Width="56" Height="17"
Text="Change Folder" />
....
<Publish Dialog="myDlg" Control="ChangeFolder" Property="_LogBrowseProperty" Value="[CUSTOMDIR]" Order="1">1</Publish>
<Publish Dialog="myDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Property Id="_LogBrowseProperty" Value="TARGETDIR" />
I was looking for a while at trying to do the same thing and amended the Wix BroseDlg dialog to achieve this.
In the parent control I had the following path edit and push button controls:
<Control Id="LogFilePathValue" Type="PathEdit" X="50" Y="205" Width="215" Height="18" Property="LOGFILE_PATH"/>
<Control Id="LogFilePathButton" Type="PushButton" X="270" Y="205" Width="50" Height="17" Text="!(loc.LogFilePathButton_Text)">
<Publish Property="LOGFILE_PATH_TEMP" Value="[LOGFILE_PATH]" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="MyLogFileDialog" Order="2">1</Publish>
</Control>
</Control>
MyLogFileDialog then looked like this:
<Dialog Id="MyLogFileDialog" Width="370" Height="270" Title="!(loc.MyLogFileDialog_DialogTitle)">
<Control Id="PathEdit" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="LOGFILE_PATH_TEMP" />
<Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
<Publish Property="LOGFILE_PATH" Value="[LOGFILE_PATH_TEMP]" Order="1">1</Publish>
<Publish Event="EndDialog" Value="Return" Order="2">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10" TabSkip="no" Text="!(loc.BrowseDlgComboLabel)" />
<Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="LOGFILE_PATH_TEMP" Fixed="yes" Remote="yes">
<Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
</Control>
<Control Id="WixUI_Bmp_Up" Type="PushButton" X="298" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgWixUI_Bmp_UpTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgWixUI_Bmp_Up)">
<Publish Event="DirectoryListUp" Value="0">1</Publish>
</Control>
<Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgNewFolderTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgNewFolder)">
<Publish Event="DirectoryListNew" Value="0">1</Publish>
</Control>
<Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="98" Property="LOGFILE_PATH_TEMP" Sunken="yes" TabSkip="no" />
<Control Id="PathLabel" Type="Text" X="25" Y="190" Width="320" Height="10" TabSkip="no" Text="!(loc.BrowseDlgPathLabel)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.BrowseDlgBannerBitmap)" />
<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="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.MyLogFileDialog_TitleBody)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.MyLogFileDialog_TitleMain)" />
</Dialog>
You then have to make sure the property LOGFILE_PATH is set prior to calling this parent form. In my case I'm using my own version of the UI_Mondo so I set the property after the user has selected the install type:
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Property="LOGFILE_PATH" Value="[COMPONENTINSTALLFOLDER]\Logs" Order="1">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ParentDialogWithLogLocationControls" Order="2">1</Publish>
Try to examine the WiXUIExtension closer, especially the WixUI_InstallDir.wxs and InstallDirDlg.wxs. See how the controls and dialogs are set up in order to handle directory browsing properly and try to adjust it to your needs.
From InstallDirDlg.wxs:
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
From WixUI_InstallDir.wxs:
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
...
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>