Reputation: 1231
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.
Upvotes: 0
Views: 825
Reputation: 2081
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.
Upvotes: 0