Wednesday 10 October 2012

Add a Radio Button Group to Wix Installer

I spent a good hour yesterday banging my head against the Wix wall again. I was trying to add a radio button to an installer, but not matter what I did the buttons would not be displayed.

It took me far too long to realize that the positions of the Radiobuttons are relative to the Radiobuttongroup control. The problem was that I was setting positions for the page, which meant that they were miles off and not being displayed.

The property is used to set some values in a config file.

This is what I ended up using:

I defined this property in the Product.wxs

<Property Id="AUTH" Secure="yes" Value="False"/>

and used this in the UI.wxs file
 <Dialog Id="UserDetailsDlg" Width="370" Height="270" Title="[ProductName] Setup">
   <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Service Details" />
   <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Enter Service Details" />
   <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
   <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
   <Control Id="DomainNameLabel" Type="Text" X="20" Y="70" Width="135" Height="13" Text="Domain:" />
   <Control Id="DomainName" Type="Edit" X="161" Y="70" Width="180" Height="15" Property="DOMAINNAME" />
   <Control Id="UserNameLabel" Type="Text" X="20" Y="90" Width="135" Height="13" Text="User Name:" />
   <Control Id="UserName" Type="Edit" X="161" Y="90" Width="180" Height="15" Property="USER"  />
   <Control Id="PasswordLabel" Type="Text" X="20" Y="110" Width="135" Height="13" Text="Password:" />
   <Control Id="Password" Type="Edit" Password="yes" X="161" Y="110" Width="180" Height="15" Property="PASSWORD" />
   <Control Id="LBLabel" Type="Text" X="20" Y="150" Width="135" Height="13" Text="Load Balancer:" />
   <Control Id="LB" Type="Edit" X="161" Y="150" Width="180" Height="15" Property="LB" />
   <Control Type="Text" Id="ADFSLabel" Width="50" Height="17" X="20" Y="190" Text="ADFS"/>
   
   
   <Control Type="RadioButtonGroup" Property="AUTH" Id="AUTH" Width="144" Height="44" X="161" Y="190">
     <RadioButtonGroup Property="AUTH">
       <RadioButton Text="Integrated Authentication" Height="13" Value="False" Width="150" X="0" Y="0" />
       <RadioButton Text="ADFS" Height="13" Value="True" Width="50" X="0" Y="15" />
     </RadioButtonGroup>
   </Control>
   
   
   <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
   <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
     <Condition Action="disable">
       (USER = "") OR (PASSWORD = "") OR (DOMAINNAME = "")  OR (LB = "")
     </Condition>
     <Condition Action="enable">
       <![CDATA[(USER <> "") AND (PASSWORD <> "") AND (DOMAINNAME <>"")  AND (LB <> "")  ]]>
     </Condition>
   </Control>
   <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back" />
   <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
     <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
   </Control>
 </Dialog>

4 comments:

  1. Thanks. Wasted 3 hours already, but you saved me many more hours.

    ReplyDelete
  2. Thanks its saves my hours too...

    ReplyDelete
  3. Can you please tell whether I can do different operation based on the radio button option I have selected while installing the installer.

    ReplyDelete
  4. Hi.
    How to install sql Express and IIS express depending on radio button selection using wix installer

    ReplyDelete