WIX radio button group

reapen picture reapen · Jun 19, 2013 · Viewed 10.4k times · Source

I am stuck in doing with WIX radio group button,I want to know

  1. Whether i can able to disable text box based on selection of WIX radio group button like mentioned in the image below.

  2. And how is it possible to save selection of radio group button value.As i needed the selected radio box value and save in registry.

for registry is it possible to assign the 1st text box value based on this condition?

<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>

Can anyone help me.

WIX Radio group button

Answer

BBR picture BBR · Jun 20, 2013

Assuming you have your Radio Button as following:

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

you can control visibility or availablility of other elements in the dialog by using Condition sub-element:

<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>

Following the request in comments, posting an example of updating property with values of Edit elements (some required control attributes are ommited for clarity):

<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>