Set checkbox based functions

I'm trying to make sure that when the user selects something using the checkbox, the corresponding function is set.

I am aware of the ready-made function tree that Wix provides, but there are other things that I do that do not allow me to use this function. I'm curious how to link them together so that when the user selects the β€œInstall Component X” checkbox, the X function is set when the user clicks the install button.

+8
source share
3 answers

I found that this solves my problem. In order to do what I intended, I needed to create a checkbox for each individual function.

<Control Id="FeatureX" Type="CheckBox" X="191" Y="50" Width="140" Height="17" Property="FEATUREX_CHECKED" CheckBoxValue="myValue" Text="Install feature 1" /> <Control Id="FeatureY" Type="CheckBox" X="191" Y="67" Width="140" Height="17" Property="FEATUREY_CHECKED" CheckBoxValue="myValue" Text="Install feature 1" /> <Control Id="FeatureZ" Type="CheckBox" X="191" Y="84" Width="140" Height="17" Property="FEATUREZ_CHECKED" CheckBoxValue="myValue" Text="Install feature 1" /> 

Now, as soon as I did this, I added a publication to each of them and made a condition that made it so that only if this box is checked, this function will be installed. For example:

 <Control Id="Next" Type="PushButton" Text="Next" X="254" Y="243" Height="17" Width="56"> <Publish Event="Remove" Value="ALL" Order="1">1</Publish> <Publish Event="AddLocal" Value="FeatureX" Order="2"> <![CDATA[FEATUREX_CHECKED]]> </Publish> </Control> 

Note:

Delete is used to deselect everything starting from the installation (I was informed that as soon as the user interface is called, it is too late to change the levels of functions).

Then each function checks to see if the corresponding flag has been selected, and if this adds it to the AddLocal property. AddLocal will look like this if you look at it:

 ADDLOCAL=FeatureX,FeatureY,FeatureZ... 

The last thing I needed to do to get this to work was to check my main.wxs too to make sure that FeatureID is used in the checkboxes corresponding to the ComponentGroupRefID used:

  <ComponentGroupRef Id="FeatureX"/> 

So, here it is ... I again thank everyone for their help in this. If anyone reading this is embarrassed by anything, please feel free to email me and I will do my best to explain things a bit further.

+7
source

Recommendations for checkboxes are very similar to advice for radio buttons . Use AddLocal and Remove control events on the Next or Install button, each of which is associated with binding to your cells. It's too late to use function setting levels while you are showing the user interface.

0
source

This is my sample code for setting functions.

Product.wxs

 <Product Id="{C9FD5DDE-2625-4E01-B415-8A734464F341}" Name="!(wix.Product)" Language="1033" Version="1.0.0.0" Manufacturer="!(wix.Manufacturer)" UpgradeCode="!(wix.UpgradeCode)"> <Package InstallerVersion="200" Compressed="yes" Languages="1033" Manufacturer="!(wix.Manufacturer)" Description="!(wix.ProductDesc)"/> <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> <WixVariable Id="UpgradeCode" Value="{E5695E2A-EE5F-4EEE-A326-98A9F8B2EF0A}"/> <WixVariable Id="Manufacturer" Value="BSDreams"/> <WixVariable Id="Product" Value="WixSubFeatures"/> <WixVariable Id="ProductDesc" Value="Minimal select one feature install"/> <WixVariable Id="ProductIcon" Value="chk_on.ico"/> <WixVariable Id="WixSubFiles" Value=".\Files"/> <Property Id="ARPNOMODIFY" Value="0" /> <Property Id="ARPPRODUCTICON" Value="!(wix.ProductIcon)" /> <Property Id="INSTALLDIR"> <RegistrySearch Id="WixSubFeaturesSearch" Type="raw" Root="HKCU" Key="!(wix.Manufacturer)\!(wix.Product)" Name="InstallDir" /> </Property> <Icon Id="chk_on.ico" SourceFile="!(wix.WixSubFiles)\!(wix.ProductIcon)"/> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ManufacturerDir" Name="!(wix.Manufacturer)"> <Directory Id="INSTALLDIR" Name="!(wix.Product)"> <Component Id="ProductMain" Guid="{FF35C142-480A-4d67-A2ED-E5C9E508F809}"> <CreateFolder /> <RegistryKey Id="WixSubDirReg" Root="HKCU" Key="!(wix.Manufacturer)\!(wix.Product)" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Value="[INSTALLDIR]" Action="write"/> </RegistryKey> </Component> </Directory> </Directory> </Directory> <UIRef Id="UserInterface"/> <Feature Id="PRODUCTFEATURE" Title="!(wix.Product)" Level="1" > <ComponentRef Id="ProductMain"/> <ComponentRef Id="IconFile"/> <Feature Id="OPTIONA" Title="Option A" Level="1" > <ComponentRef Id="TestFileA"/> </Feature> <Feature Id="OPTIONB" Title="Option B" Level="3" > <ComponentRef Id="TestFileB"/> </Feature> <Feature Id="OPTIONC" Title="Option C" Level="3" > <ComponentRef Id="TestFileC"/> </Feature> </Feature> <DirectoryRef Id="INSTALLDIR"> <Component Id="IconFile" Guid="{967A5110-B0F8-47b0-967B-CC4624D06EA5}"> <File Id="IconFileA" Source="!(wix.WixSubFiles)\!(wix.ProductIcon)" Name="chk_on.ico" Vital="yes" /> </Component> <Component Id="TestFileA" Guid="{F5ACE3D7-03DE-47a7-9CE8-50CEF5E9A7BF}"> <File Id="SomeFileA" Source="!(wix.WixSubFiles)\SomeFileA.txt" Name="BSDA.txt" Vital="yes"/> </Component> <Component Id="TestFileB" Guid="{CB5D53FB-8CED-42ef-89FF-08C7709CFCA5}"> <File Id="SomeFileB" Source="!(wix.WixSubFiles)\SomeFileB.txt" Name="BSDB.txt" Vital="yes" /> </Component> <Component Id="TestFileC" Guid="{987EA193-A1E0-41d2-8E9D-87D30D8F03AD}"> <File Id="SomeFileC" Source="!(wix.WixSubFiles)\SomeFileC.txt" Name="BSDC.txt" Vital="yes" /> </Component> </DirectoryRef> <CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" /> <InstallExecuteSequence> <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"></Custom> </InstallExecuteSequence> </Product> 

UserInterface.wxs

 <Fragment Id="WixSubUI"> <UI Id="UserInterface"> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" /> <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" /> <DialogRef Id="InstallDirDlg"/> <DialogRef Id="FeaturesDlg" /> <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="2"></Publish> <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish> <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="FeaturesDlg">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> <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish> <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="ExitDialog" Order="2">1</Publish> <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> </UI> <UIRef Id="WixUI_Common" /> 

This will give you a basic installer that installs the base on the selected functions. User interface

0
source

All Articles