如何基于wix工具集安装程序中的复选框启用或禁用单选按钮

时间:2018-11-16 12:40:47

标签: windows wix installer

我创建了wix安装程序,并在其中添加了复选框和相应的单选按钮。如果未选中该复选框,则应该禁用相应的单选按钮。用户只有在选中复选框的情况下才可以选择安装。图像仅供参考。

Dialog with radio button and Checkbox

1 个答案:

答案 0 :(得分:1)

根据Bob Arnson on the wix-users forums,显然无法禁用按钮组中的一个单选按钮:

  

MSI不支持。以MSI而言,单选按钮组是   控件和单选按钮是非控件子级。它很烦人   而且不直观,但这就是MSI目前的工作方式。

但是,即使您不能启用或禁用(隐藏或显示)按钮组中的单个按钮,也可以对整个按钮组执行此操作。例如:

<Control Id="InstallationTypeRadioButton" Type="RadioButtonGroup" Property="INSTALLTYPE" X="135" Y="150" Width="220" Height="38">
  <RadioButtonGroup Property="INSTALLTYPE">
    <RadioButton Value="FULL" Text="Sandalone" X="0" Y="0" Width="220" Height="20" />
    <RadioButton Value="DISTRIBUTED" Text="Distributed" X="0" Y="20" Width="220" Height="20" />
  </RadioButtonGroup>
</Control>

<Control Id="InstallationDistributedTypeRadioButton" Type="RadioButtonGroup" Property="DISTRIBUTEDTYPE" X="135" Y="188" Width="220" Height="40">
  <RadioButtonGroup Property="DISTRIBUTEDTYPE">
    <RadioButton Value="MASTER" Text="Master" X="15" Y="0" Width="220" Height="20" />
    <RadioButton Value="SLAVE" Text="Slave" X="15" Y="20" Width="220" Height="20" />
  </RadioButtonGroup>
  <Condition Action="show"> <![CDATA[INSTALLTYPE="DISTRIBUTED"]]> </Condition>
  <Condition Action="hide"> <![CDATA[INSTALLTYPE<>"DISTRIBUTED"]]> </Condition>
</Control>

这段代码允许您根据另一个按钮组中的选择来显示或隐藏单选按钮组。

结果如下:

the visual example for this code

相关问题