How to get the selected ComboBox value in wix toolset? - wix

I have used WIXUI_INSTALLDIR template to bundle the installer. Here I have a custom form between welcome dialog and license dialog which consist of three ListItems inside Combobox.
I tried to access the dropdown value with bind.property.SK_Version. For example, <Directory Id='INSTALLDIR' Name="!(bind.property.SK_Version)">. However it always return the value of first item in the list. Can you suggest me the best way to get selected value from combobox in wix toolset.

Bind variables are a build time concept. At runtime, MSI uses Properties. There is a property associated with your combobox and each selection has a value and a display text. The value gets assigned to the property. From there you need to use a Set Property custom action to build your INSTALLLOCATION property based on the value of that property.
https://learn.microsoft.com/en-us/windows/win32/msi/combobox-table

Related

VBA Adding a User Defined Control to Userform at Runtime

So I've made the following control in Design Mode then added the control to a new page Custom in my toolbox.
Now, what would I use for the progID parameter in Controls.Add()? How do I look up this value? Controls.Add("Forms.Frame.1") adds a regular frame, not the desired custom control.
As far as I am aware, you do not generate a new progID with a custom control. Per the MSDN documentation for custom/modified controls:
Note: When you drag a control onto the Control Toolbox, you only transfer the advanced property values.
So only the properties are transferred; the actual control is still of the same type/s as the one you created it from. Further, it looks like this progID is "a unique system-wide string that the Windows operating system can use to identify your control's type." So unless you are up to coding your own control, it looks as though you're just passing properties to the custom toolbox controls you create there.
You'll have to just replicate the custom control each time you want to add it. Just create a sub with all the correct properties and call it. Not what you were looking for, but it'll get the job done.

MSI Installer and Required Radio Button Selection

I'm using VS 2010 and need to make a change in an MSI installer.
I'm not that familiar with the installer creation -- it seems very limited.
I needed to add a new dialog that pops up and asks the user to select one of two possible installation directories. The dialog is the "RadioButtons (2 buttons)" dialog.
Depending on which radio button you select, the ButtonProperty sets TARGETDIR to either:
[AppDataFolder]MyInstall
or
[ProgramFiles64Folder]MyInstall
I have the DefaultValue for the button set to [ProgramFiles64Folder]MyInstall
I've got everything working -- at least when the user selects one of the radio buttons.
The problems are:
The default radio button isn't preselected when the dialog is displayed and it's possible for the user to advance to the next screen without selecting one of the radio buttons. How can I prevent that?
When the default value is set to something like [ProgramFiles64]MyInstall, on uninstall I get an error that it could not access the network location [ProgramFiles64]MyInstall -- even if that is not the location where the files were installed. If the path for the DefaultValue is a fully expanded absolute path, then there is no error.
With this code you van preselect the radiobutton: radiobutton.Checked = true

How to resolve ICE03: String overflow in WiX?

In my installer a feature tree control in the maintenance dialog publishes two events that sets a property named DisableInstallBtn to 0 or 1, respectively. And DisableInstallBtn is used by the condition of enable/disable action of Install button. It behaves like this: If all the features are 'deselected' then the Install button becomes disabled.
So, each event(Publish element) has a condition to be published. For example, the event that sets DisableInstallBtn to 1 has a condition like this: <![CDATA[(!Feature1=2 OR &Feature1=2) AND ... AND (!FeatureN=2 OR &FeatureN=2)]]>(If you don't understand the syntax of this condition you can check http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/expression-syntax)
The problem is this condition string is too long so that I get String overflow warning when I compile .wxs file. Is there any way to resolve this problem? Thanks.
WiX's built-in CustomizeDlg (located under src\ext\UIExtension\wixlib if you have the source code) already has the functionality you're looking for in its next button. Just subscribe to the SelectionNoItems event.
<Control Id="Install" Type="PushButton">
<Subscribe Event="SelectionNoItems" Attribute="Enabled" />
</Control>
The SelectionTree control has a lot of events associated with it. You can view them here.
EDIT
It seems that I've misunderstood the documentation. The SelectionNoItems only fires when the selection tree has no nodes, not when the current selection has no nodes.
Starting with Windows Installer 3.0, the selection tree publishes a DoAction event, which fires when there's a change in your selection tree.
You can then check your feature selection in your custom action and set the Control.Attributes column of your next button. You can see here for a list of attributes and their values (enabled is equal to 2).
Otherwise, you can always do your validation on clicking next.

Datagrid View in a custom control

I am trying to add datagridview control in my custom control but i failed.
I started creating new project[windows custom control library], added datagridview control on it and also added a property naming "DGVMain" which refers to datagridview control.
I compiled it.
While testing i find its properties like visible and other working but when i click on columns property it doesn't work. i.e i cannot add/edit columns into the datagridview of my custom control.
Did i miss any steps or do i need to add some more actions?
As you don't have other control within your custom control, maybe an inherited user control would be more appropriate in this case and I'm sure it will also fix your problem.

Include ServiceDependancy if checkbox selected WIX

Is it possible to include a ServiceDependency based on whether a checkbox was selected in a WIX application?
Your check box control will likely set a property. You could then use a condition on a component to control if that component, which adds the service dependency, is installed.