Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide textboxes on checkbox checked in WiX

Is it possible to hide textboxes on checkbox checked in WiX?

like image 571
Bogdan Verbenets Avatar asked Mar 31 '11 13:03

Bogdan Verbenets


2 Answers

Thanks for your comments, the first comment helped me. It is done like this:

<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
    <Condition Action="hide" >CreateDBUsers&lt;&gt;1</Condition>
    <Condition Action="show" >CreateDBUsers=1</Condition>
</Control>
like image 189
Bogdan Verbenets Avatar answered Nov 04 '22 05:11

Bogdan Verbenets


This is a very old question, and the answer is: Yes it is possible.

I finally get how this works based on this blog post and Bogdan Verbenets's answer. To elaborate already chosen answer, this snippet based on his answer might help you understand more:

<Control Id="AnyCheckBox" Type="CheckBox" Height="17" Width="10" X="150" Y="180" Property="CreateDBUsers" CheckBoxValue="1" />

<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
  <Condition Action="hide"><![CDATA[CreateDBUsers<>"1"]]></Condition>
  <Condition Action="show">CreateDBUsers="1"</Condition>
</Control>

Which the above code work the same as below:

<Control Id="AnyCheckBox" Type="CheckBox" Height="17" Width="10" X="150" Y="180" Property="CreateDBUsers" CheckBoxValue="0" />

<Control Id="LoginTextBox" Type="Edit" Text="CM2" Height="17" Width="200" X="150" Y="198" Property="Login">
  <Condition Action="hide"><![CDATA[CreateDBUsers<>"0"]]></Condition>
  <Condition Action="show">CreateDBUsers="0"</Condition>
</Control>

Please pay attention to CheckBoxValue which its value determine what you going to write in the condition text.

Note:

  • It better to use <![CDATA[ write_something_here ]]> when you need to write conditional involving < (less than equal) or > (greater than equal).
  • It might more proper to use string ("1", "0") in condition text since CheckBoxValue actually use string data type, you can check at official documentation. Although this is not mandatory.

Check box is definitely quite a something different in WiX.

like image 20
ichan-akira Avatar answered Nov 04 '22 04:11

ichan-akira