Using checkboxes wix - 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..:)

Related

I need a help. Kindly find the below code

I have created two dialogs. Once clicked CustomCheckA (Nextbutton) it should go to CustomCheckB dialog and once clicked yes on the CustomCheckB dialog it should move to next new dialog. and it should hide the previous dialog. What need to be added in the below code to hide the CustomCheckA dialog
<Dialog Id='CustomCheckA' X='50' Y='50' Width='373' Height='287' Title='[ProductName]'>
<Control Id='Next' 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='SpawnDialog' Value='CustomCheckB' />
<Dialog>
<Dialog Id='CustomCheckB' X='50' Y='50' Width='373' Height='100' Title='[ProductName]'>
<Control Id='NoButton' Type='PushButton' X='300' Y='60' Width='65' Height='21' Text='{\VSI_MS_Sans_Serif13.0_0_0}&No' TabSkip='no' Default='yes' Cancel='yes'>
<Publish Event='EndDialog' Value='Exit' />
</Control>
<Control Id='YesButton' Type='PushButton' X='230' Y='60' Width='65' Height='21' Text='{\VSI_MS_Sans_Serif13.0_0_0}&Yes' TabSkip='no' Default='yes' >
<Publish Event='NewDialog' Value='[CustomCheckB_NextArgs]'><![CDATA[CustomCheckB_NextArgs<>""]]></Publish>
</Control>
<Control Id='BodyText' Type='Text' X='6' Y='9' Width='345' Height='36' Text='{\VSI_MS_Sans_Serif13.0_0_0}WARNING' TabSkip='yes' NoPrefix='yes' />
</Dialog>

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. :)

Wix CheckBox default state

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.

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.

Populating Wix Combo Box

Im using the code from from this link
and my Wix Dialogs looks like this
<Control Id="DummyComboBox" Hidden="yes" Type="ComboBox" Sorted="yes" ComboList="yes" Property="DUMMYPROPERTY" X="65" Y="60" Width="150" Height="18">
<ComboBox Property="DUMMYPROPERTY">
<ListItem Text="Dummy" Value="Dummy"/>
</ComboBox>
</Control>
<Control Id="SQLServer" Type="ComboBox" Sorted="yes" ComboList="yes" X="150" Y="100" Width="110" Height="18" Property="DBSERVER"/>
<Control Id="SQLServerLabel" Type="Text" X="25" Y="100" Width="90" Height="18" NoPrefix="yes" Text="!(loc.SQLServerLabel)"/>
<Control Id="SQLDatabaseName" Type="Edit" X="150" Y="120" Width="110" Height="18" Property="SQLDBNAME"/>
<Control Id="SQLDBServerLabel" Type="Text" X="25" Y="120" Width="90" Height="18" NoPrefix="yes" Text="!(loc.SQLDatabaseLabel)"/>
<Control Id="SQLUser" Type="Edit" X="150" Y="140" Width="110" Height="18" Property="SQLUSER"/>
<Control Id="SQLUServerLabel" Type="Text" X="25" Y="140" Width="90" Height="18" NoPrefix="yes" Text="!(loc.SQLUserLabel)"/>
<Control Id="SQLPassword" Type="Edit" X="150" Y="160" Width="110" Height="18" Property="SQLPASSWORD" Password="yes"/>
<Control Id="SQLPServerLabel" Type="Text" X="25" Y="160" Width="90" Height="18" NoPrefix="yes" Text="!(loc.SQLPasswordLabel)"/>
I have walked through the code and it's functioning properly. However when I display the Wix Dialog the combo box is empty. Any idea as to what I'm doing wrong
Quite simple ...
Hidden="yes"
Hidden="no"
You are hiding it.
You need to write custom actions to fill the combo boxes for e.g. for filling Server Instance combo box u may be write some thing like given below:-
public static ActionResult FillServerInstances(Session xiSession)
{
xiSession.Log("Begin CustomAction");
xiSession.Log("Opening view");
View lView = xiSession.Database.OpenView(
"DELETE FROM ComboBox WHERE ComboBox.Property='DBSRVR'");
lView.Execute();
lView = xiSession.Database.OpenView("SELECT * FROM ComboBox");
lView.Execute();
int Index = 1;
bool flag = false;
try
{
foreach (DataRow dr in Microsoft.SqlServer.Management.Smo.SmoApplication
.EnumAvailableSqlServers(false).Rows)
{
String InstanceName = dr["Name"].ToString();
if (InstanceName.Equals(xiSession["ComputerName"]
+ #"\"
+ xiSession["SQLINSTANCENAME"],
StringComparison.InvariantCultureIgnoreCase))
{ flag = true; }
Record lRecord = xiSession.Database.CreateRecord(4);
xiSession.Log("Setting record details");
lRecord.SetString(1, "DBSRVR");
lRecord.SetInteger(2, Index);
lRecord.SetString(3, InstanceName);
lRecord.SetString(4, InstanceName);
xiSession.Log("Adding record");
lView.Modify(ViewModifyMode.InsertTemporary, lRecord);
++Index;
}
}
catch (Exception ex)
{
logException(xiSession, ex);
}
if (flag)
{
xiSession["DBSRVR"] = xiSession["ComputerName"].ToString()
+ #"\" + xiSession["SQLINSTANCENAME"].ToString();
}
lView.Close();
xiSession.Log("Closing view");
lView.Close();
return ActionResult.Success;
}