5

我一直在使用 WIX 单选组按钮,我想知道

  1. 我是否可以根据选择 WIX 单选组按钮来禁用文本框,如下图所示。

  2. 以及如何保存单选组按钮值的选择。因为我需要选择的单选框值并保存在注册表中。

对于注册表,是否可以根据此条件分配第一个文本框值?

<Condition><![CDATA[if (RADIOGROUP=1)<Property Id="RADIOGROUP" Value="[TEXTBOX1]" />]]></Condition>
   <RegistryKey Root="HKLM" Key="SOFTWARE\Company\Service" >
   <RegistryValue Name="RADIOGROUP" Value="[RADIOGROUP]" Type="string" >
                  </RegistryKey>

谁能帮我。

WIX Radio 组按钮

4

1 回答 1

12

假设您的单选按钮如下:

<RadioButtonGroup Property="SOME_PROPERTY">
    <RadioButton Value="0" Text="disable / hide labels" />
    <RadioButton Value="1" Text="enable / show labels" />
</RadioButtonGroup>

您可以使用Condition子元素控制对话框中其他元素的可见性或可用性:

<Control Id="SomeLabel" Type="Text" Text="text:">
    <Condition Action="disable"><![CDATA[SOME_PROPERTY <> "1"]]></Condition>
    <Condition Action="enable"><![CDATA[SOME_PROPERTY = "1"]]></Condition>
</Control>

<Control Id="SomeLabel2" Type="Text" Text="text2:">
    <Condition Action="hide">SOME_PROPERTY = "0"></Condition>
    <Condition Action="show">SOME_PROPERTY = "1"></Condition>
</Control>

按照评论中的请求,发布一个使用 Edit 元素值更新属性的示例(为清楚起见,省略了一些必需的控件属性):

<CustomAction Id="CA_SET_TO_A" Property="P" Value="[AA]" />
<CustomAction Id="CA_SET_TO_B" Property="P" Value="[BB]" />

<Dialog Id="MyDialog" Title="[ProductName] Setup">
    <Control Id="Next" Type="PushButton" Default="yes" Text="!(loc.WixUINext)">
        <Publish Event="DoAction" Value="CA_SET_TO_A">R="USE_A"</Publish>
        <Publish Event="DoAction" Value="CA_SET_TO_B">R="USE_B"</Publish>
    </Control>

    <Control Id="MyRadioButton" Type="RadioButtonGroup" Property="R">
        <RadioButtonGroup Property="R">
            <RadioButton Value="USE_A" Text="Save text field 1" />
            <RadioButton Value="USE_B" Text="Save text field 2" />
        </RadioButtonGroup>
    </Control>

    <Control Id="A" Type="Edit" Property="AA" Text="{64}">
        <Condition Action="disable">R="USE_B"</Condition>
        <Condition Action="enable">R="USE_A"</Condition>
    </Control>
    <Control Id="B" Type="Edit" Property="BB" Text="{64}">
        <Condition Action="disable">R="USE_A"</Condition>
        <Condition Action="enable">R="USE_B"</Condition>
    </Control>
</Dialog>
于 2013-06-20T06:47:18.093 回答