Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set property value from user selection in wix

I have a window with 3 radiobuttons like this(removed all non interesting props):

<Control Id="Back" Type="PushButton" Text="!(loc.WixUIBack)">
   <Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" Text="!(loc.WixUICancel)">
   <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" Text="!(loc.WixUINext)">
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
</Control>
<Control Id="InstallTypeSelection" Type="RadioButtonGroup" Property="INSTALL_TYPE">
   <RadioButtonGroup Property="INSTALL_TYPE">
      <RadioButton Value="0" Text="InstallType A" />
      <RadioButton Value="1" Text="InstallType B" />
      <RadioButton Value="2"Text="InstallType C" />
   </RadioButtonGroup>

On "next" I want to sett some propertys based on what the Installtype the user did select.

like this..

if(INSTALL_TYPE == 0)
{
   REG_VALUE_AUTO_LOGIN = 0;
   REG_VALUE_TIMEOUT = 300;
}
if(INSTALL_TYPE == 1)
{
   REG_VALUE_AUTO_LOGIN = 1;
   REG_VALUE_TIMEOUT = 600;
}

How does this work in wix?

like image 417
Qwark Avatar asked Aug 27 '10 08:08

Qwark


1 Answers

I run into something like this a week ago. I don't remember the syntax correctly, but it looks something like this. For my taste, it not very clean, but it should do the work.

<Control Id="Next" Type="PushButton" Text="!(loc.WixUINext)">
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
   <!-- INSTALL_TYPE == 0 -->
   <Publish Property="REG_VALUE_AUTO_LOGIN" Value="1">INSTALL_TYPE  = "0"</Publish>
   <Publish Property="REG_VALUE_TIMEOUT" Value="300">INSTALL_TYPE  = "0"</Publish>

   <!-- INSTALL_TYPE == 1 -->
   <Publish Property="REG_VALUE_AUTO_LOGIN" Value="1">INSTALL_TYPE  = "1"</Publish>
   <Publish Property="REG_VALUE_TIMEOUT" Value="600">INSTALL_TYPE  = "1"</Publish>

   <! -- FINALLY, CALL NEXT DIALOG : added by Chris Painter -->
   <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 

</Control>

I didn't have the time to test it, but I think it the way to go for the least. I hope it going to help you.

Cheers.

like image 144
Deacon Frost Avatar answered Nov 14 '22 04:11

Deacon Frost