Wix CheckBox default state - wix

The dialog below displays a checkbox which on selected enables the Next Button. The problem is I cant get the initial state of it to be set to unchecked when the form first appears. I have tried setting the CheckBoxValue = 1 but that doesnt either work.
<Dialog Id="DatabaseDialog" X="50" Y="50" Width="373" Height="287" Title="[ProductName]">
<Control Id="EnableCheckBox" Property="DatabaseBackedUp" Type="CheckBox" X="20" Y="150" Width="290" Height="30"
Text="Has the database been backed up?" CheckBoxValue="0" />
<Control Id="NextButton" Type="PushButton" X="300" Y="261" Width="66" Height="18" Text="{\VSI_MS_Sans_Serif13.0_0_0}&Next >" TabSkip="no" Default="yes">
<Publish Event="EndDialog" Value="Return">DatabaseDialog_NextArgs=""</Publish>
<Publish Event="NewDialog" Value="[DatabaseDialog_NextArgs]">DatabaseDialog_NextArgs<>""</Publish>
<Condition Action="disable"><![CDATA[DatabaseBackedUp<> "1"]]></Condition>
<Condition Action="enable"><![CDATA[DatabaseBackedUp= "1"]></Condition>
</Control>
</Dialog>

This is the way I do it and it works for me
The Property:
<Property Id="CHECKBOX" Secure="yes"></Property>
The checkbox:
<Control Id="CheckBoxId" Type="CheckBox" Text="Use the proxy server for your LAN" Property="CHECKBOX" Width="180" Height="15" X="25" Y="103" CheckBoxValue="1"/>
I believe this works because you are firstly setting the property linked to the checkbox to nothing so it stays empty and if it is clicked then the property value is equal to whatever the CheckBoxValue is set to. (That's my logic anyway..:)) Hope this helps

You have defined a control:
<Control Id="EnableCheckBox"
Type="CheckBox"
Property="DatabaseBackedUp"
X="20" Y="150" Width="290" Height="30"
Text="Has the database been backed up?"
CheckBoxValue="0" />
You don't mention whether you have also defined a DatabaseBackedUp property elsewhere in your solution, but I assume that you have defined something like this:
<Property Id="DatabaseBackedUp" Value="0"></Property>
You may have tried other values for Value. However, I believe the checkbox will interpret the existence of any value as meaning "I should be checked".
However, if you do not set a Value attribute then you will get a warning: "Property 'CHECKBOX' does not contain a Value attribute and is not marked as Admin, Secure, or Hidden. The Property element is being ignored."
Setting one of these attributes will make the warning go away, but will come with additional behaviour that may or may not be desired.
The solution is simply to delete the property.
The checkbox will then find no value for it and will default to unchecked. Checking it will still work as desired (i.e. it will create and set a value for the property).
I have tried this successfully with WiX v3.11.1.

Related

How to insert a Groupbox and image in setup dialog in wix Installer

Am developing an installer for my application using wix installer.installer. Wix is really new to me .
In that installer am having a custom dialog and where i have kept check boxes inside it.
<Control Id="InstallWORD" Type="CheckBox" X="20" Y="200" Width="200" Height="17" Property="INSTALLWORD" CheckBoxValue="1"
Text="Install Word Plug-In?" />
the above is the code i used for keeping check box. But now i need to insert a small picture near the checkbox (ie)
similar like this
how to make it possible in wix installer??
Thanks .
Need to add a Binary element to the file:
<Binary Id="MainImage" SourceFile="Resources/Images/weblabel.jpg" />
...and to set the Text of the Bitmap Control to "MainImage":
<Control Id="Bitmap"
Type="Bitmap"
X="0"
Y="0"
Width="258"
Height="185"
TabSkip="no"
Text="MainImage" />
and for adding a group box
<Control Id="grpBox" Type="GroupBox" X="8" Y="50" Width="355" Height="210" Text="Add-in for Microsoft Office" ></Control>
and now it works. :)

Using checkboxes wix

Hi I was trying to launch a custom action from a radio button but realized this cannot be done. Instead I created two checkboxes. I want them to have a shared property which I have done so as shown in my code but I would need for the user only to be able to select one at a time not both.
Heres my code:
<Control Id="CheckBoxLock" Type="CheckBox" Text="DiskID/NIC Adapter Address" Property="LOCKTYPE" X="50" Y="215" Width="200" Height="15" CheckBoxValue="0">
</Control>
<Control Id="CheckBoxLock2" Type="CheckBox" Text="Hardware Key Serial Number" CheckBoxPropertyRef="LOCKTYPE" X="50" Y="230" Width="200" Height="15" CheckBoxValue="1">
<Publish Event="DoAction" Value="OnLockOptionModified"><![CDATA[LOCKTYPE = "1"]]></Publish>
</Control>
Any help would be greatly appreciated. Thanks
Long way around it but I created a work around that works:
<Control Id="CheckBoxLock" Type="CheckBox" Text="DiskID/NIC Adapter Address" Property="LOCKTYPESW" X="90" Y="215" Width="200" Height="15" CheckBoxValue="0">
<Publish Property="LOCKTYPE" Value="[LOCKTYPESW]">1</Publish>
<Publish Property="LOCKTYPEHW" Value="{}">1</Publish>
<Publish Event="DoAction" Value="OnLockOptionModified"><![CDATA[LOCKTYPE = "0"]]></Publish>
</Control>
<Control Id="CheckBoxLock2" Type="CheckBox" Text="Hardware Key Serial Number" Property="LOCKTYPEHW" X="90" Y="230" Width="200" Height="15" CheckBoxValue="1">
<Publish Property="LOCKTYPE" Value="[LOCKTYPEHW]">1</Publish>
<Publish Property="LOCKTYPESW" Value="{}">1</Publish>
<Publish Event="DoAction" Value="OnLockOptionModified"><![CDATA[LOCKTYPE = "1"]]></Publish>
</Control>
Then my custom action reads the LOCKTYPE property. Hope this helps someone else as it has taken me two hours figuring it out..:)

TextStyle and no effect of coloring the text

I have defined the TextStyle as
<TextStyle Id="subHeadingFont" FaceName="Tahoma" Size="9" Bold="yes" Blue="255" Italic="yes" Green="0" Red="0" />
and Later used it in control like this
<Control Id="Password" Type="Edit" X="20" Y="195" Width="150" Height="18" Property="WIXUI_SA.PASSWORD" Indirect="yes" Text="{\subHeadingFont}" ToolTip="Password Dude"/>
On the UI I don't get the text in Blue, any pointers what did I do wrong here?
it seems its not possible to change the color of "edit" control
Ref: http://msdn.microsoft.com/en-us/library/aa372074(v=vs.85).aspx
This column specifies the text color displayed by a Text Control. All other types of controls always use the default text color.

Ability to return exception/error detail in FatalError Dlg

I created my own dialog and had a property known as ACTIVATIONERROR which is set via a custom action. When it gets to the fatal error dialog it never displays as expected.
Example:
<Control Id="Description4" Type="Text" X="135" Y="110" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Error}The error was:" />
<Control Id="Description2" Indirect="yes" Type="Text" X="200" Y="110" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Text="ACTIVATIONERROR" Property="ACTIVATIONERROR" />
Is there something specifically on the property I have to set such as Secure property/has to be defined etc, I need to set because it acts as if it's blank.
The verbose log illustrates it's getting set:
MSI (s) (54!D8) [16:52:13:727]: PROPERTY CHANGE: Adding ACTIVATIONERROR property. Its value is 'The remote server returned an unexpected response: (405) Method Not Allowed.'.
Anybody have any idea what's going on?
C0heers,
J
Your control text should be:
[ACTIVATIONERROR]
Windows Installer uses the formatted type for installer properties.
Also, static text controls support indirection only for their text styles. Since ACTIVATIONERROR is the actual text, you should remove Indirect and Property attributes for your element.

How to get a context menu for edit boxes within WIX 3.6?

I was looking through a bug reported with some of my work's installer code yesterday and found that right click doesn't open a context menu for any of our installers.
The context menu is displayed for password boxes, so paste of me thinks it's a setting I missed when ploughing through the documentation, but I've not seen anything on google.
Is it a bug? Missing setting or a design feature?
Code is very simple and like this:
(Working Case: Password Box)
<Control Id="Label2" Type="Text" X="15" Y="123" Width="85" Height="18" Transparent="yes" Text="Password:" />
<Control Id="Edit2" Type="Text" Password="yes" X="100" Y="120" Width="235" Height="18" Property="PASSWORD" Text="[PASSWORD]" ToolTip="The password for the activation service to register the application." />
(Failing Case: Edit or Text Box)
<Control Id="Label1" Type="Text" X="15" Y="103" Width="80" Height="18" Transparent="yes" Text="Username:" />
<Control Id="Edit1" Type="Edit" X="100" Y="100" Width="235" Height="18" Property="ACTIVATIONUSERNAME" Text="[ACTIVATIONUSERNAME]" ToolTip="The username for the activation service to register the application." />
Cheers,
J
P.S I checked WIX 3.5 and the same issue seems to occur.
I've seen many times that MSI wizard does not have context menu in edit boxes. I guess it's the bug (or the feature) of Windows Installer. It subclasses all standard controls, i.e. changes their WndProc to new one, and in this case it may block context menu from appearing, perhaps unintentionally.