WIX radio button group
Asked Answered
G

1

5

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

Giliana answered 19/6, 2013 at 18:16 Comment(0)
T
13

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>
Tigon answered 20/6, 2013 at 6:47 Comment(5)
:Thank you for the answer.Can i able to get only the textbox value based on selection of say radioButton 1st.how is that possible?As i want to save the corresponding textbox(not radiobutton text) value based upon selection of radiobutton.Can you help how to do?Giliana
Create a CusomAction type 51 (property set)Tigon
Sorry, the last comment edit timed out. You want some property P to have value of either text control A or text control B, based on a value of selection in radio button R. Connect control A with property AA, control B with property BB. Create two Cusom Actions type 51 (property set) which will set P to AA if R="0" and P to BB if R="1". Call these two custom actions on "Next" button using Publish Event="DoAction" subelement. Tell me if you need the full solution.Tigon
added the example to my answer.Tigon
See this answer for an example of how to save/restore a RadioButtonGroup's selection to/from the registry: https://mcmap.net/q/1923390/-39-remember-property-39-pattern-and-the-property-used-in-radiobuttongroupUnrest

© 2022 - 2024 — McMap. All rights reserved.