How to fix high contrast setting for text control in wix toolset - wix

Disabled user control in installer GUI is not being highlighted (in green border) in high contrast windows theme, but password controls works correctly. But configuration for both elements is same.
How to fix that or is it even possible to fix that in Wix?
<Control Id="ProxyUserNameEdit" Type="Edit" X="30" Y="150" Width="200" Height="17" Help="|" Sunken="yes" Property="USER">
<Condition Action="disable"><![CDATA["1" = "1"]]></Condition>
<Control Id="ProxyPasswordEdit" Type="Edit" X="30" Y="192" Width="200" Height="17" Help="|" Sunken="yes" Password="yes" Property="PASSWORD">
<Condition Action="disable"><![CDATA["1" = "1"]]></Condition>

Related

WIX Custom Action Condition using Property Value not working

I am trying to run a custom action at the end of my Wix installer but only if certain conditions are met. The user runs through the installer and they will choose one of two modes that set the property 'ServiceType'. The two values for the property are "RegisterNew" and "LinkExisting". You can see by the log below that when the user selects "LinkExisting" in the UI that it changes the property but the custom action still runs.
MSI (c) (D4:44) [11:20:15:686]: PROPERTY CHANGE: Modifying ServiceType property. Its current value is 'RegisterNew'. Its new value: 'LinkExisting'.
Here is my custom action code:
<InstallExecuteSequence>
<Custom Action="RegisterServiceNameCustomAction" Before="InstallFinalize">
<![CDATA[(ServiceType="RegisterNew") AND (NOT Installed)]]>
</Custom>
</InstallExecuteSequence>
<Fragment>
<Binary Id="RegisterServiceCustomActionBinary" SourceFile="$(var.RegisterServiceCustomAction.TargetDir)$(var.RegisterServiceCustomAction.TargetName).CA.dll" />
<CustomAction Id="RegisterServiceNameCustomAction" BinaryKey="RegisterServiceCustomActionBinary" DllEntry="ShowRegisterService" Execute="deferred" Return="check" />
</Fragment>
Here are the different conditions I have tried:
(ServiceType="RegisterNew") AND (NOT Installed)
<![CDATA[(ServiceType="RegisterNew") AND (NOT Installed)]]>
ServiceType="RegisterNew" AND NOT Installed
Here is the code for my custom Dialog where they are selecting making their selection that will change "ServiceType":
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="SelectServiceDlg">
<Property Id="ServiceType" Value="RegisterNew" />
<Dialog Id="SelectServiceDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[DialogBitmap]" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="40" Transparent="yes" NoPrefix="yes" Text="Determine whether you need to register a new service or link an existing service." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Service Type Selection" />
<Control Id="BothScopes" Type="RadioButtonGroup" X="20" Y="55" Width="330" Height="120" Property="ServiceType">
<RadioButtonGroup Property="ServiceType">
<RadioButton Value="RegisterNew" X="0" Y="0" Width="295" Height="16" Text="Register New Service" />
<RadioButton Value="LinkExisting" X="0" Y="60" Width="295" Height="16" Text="Link Existing Service" />
</RadioButtonGroup>
</Control>
<Control Id="RegisterNewServiceDescription" Type="Text" X="33" Y="70" Width="300" Height="36" NoPrefix="yes" Text="Select this option if you are going to register a new service.">
</Control>
<Control Id="LinkExistingDescription" Type="Text" X="33" Y="130" Width="300" Height="36" NoPrefix="yes" Text="Select this option if you are going to link an existing service to this service.">
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
Here is an image of the UI:
So my question is why is it executing the custom action even though my condition is specifically checking that property?
After some reading of documentation and looking at all of the "properties" of the tag in WIX I decided to try and set a couple of other values and see what happened. I found that when defining the Property if you mark it as secure it then retains its value throughout the entire install process whereas if it is not secure it does not seem to do that. So now my property definition looks like this:
<Property Id="SERVICE_TYPE" Secure="yes" Value="RegisterNew" />
You'll notice that I had to change the name to call caps because when you mark a property as a secure property then you can not have any lowercase letters in the name.
Here is a snippet from the WIX documentation:
Secure -- YesNoType -- Denotes that the property can be passed to the server-side when doing a managed installation with elevated privileges. See the SecureCustomProperties Property for more information.
WIX Documentation For Property Element

WIX: do I have to manually recreate all elements of a dialog, including banners and buttons?

New to WIX here :-)
I added a new dialog to my WIX setup project, and it works well, except that this dialog ONLY shows the controls I added to it - it doesn't have the next/back/cancel buttons or the banner that the other dialogs have.
Did I do something wrong or do I have to manually recreate all controls, inclulding banners? If I have to manually recreate them, where do I find the WXS files that contains the originals?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<RadioButtonGroup Property="MyApp_Database_Type">
<RadioButton Height="17" Text="Dedicated" Value="Dedicated" Width="348" X="0"
Y="0" />
<RadioButton Height="17" Text="Shared" Value="Shared" Width="348" X="0"
Y="18" />
<RadioButton Height="17" Text="Single User" Value="Single User" Width="348" X="0"
Y="36" />
</RadioButtonGroup>
<Dialog Id="MyApp_UI_DatabaseProperties" X="50" Y="50" Width="373" Height="287"
Title="[ProductName]: Database Properties">
<Control Id="CTL_MyApp_UI_DatabaseProperties" Type="RadioButtonGroup" X="18" Y="108" Width="348" Height="48"
Property="MyApp_Database_Type" Text="System Type" TabSkip="no" />
<Control Id="Back" Type="PushButton" X="156" Y="243"
Width="56" Height="17" Hidden="no" Disabled="no" Text="Back" />
<Control Id="Next" Type="PushButton"
X="212" Y="243" Width="80" Height="17" Default="yes"
Text="Next" Hidden="no" Disabled="no">
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
Yes you have to fully define the dialog you want to use. Each dialog is a self contained and describing thing. It doesn't know about the layout or format of any other dialogs in the installation.
You can see examples of the dialogs you are probably using with the WixUIExtension.dll right here. This is the source code of the UIExtension's wixlib.
You should be able to simply copy over the shared components from the other dialogs into the one you are describing to get it working as you expect.

wix set install location variable from radio button

I'm trying to set two different install locations using radio buttons (single user installs to AppData and allusers installs to ProgramFiles)
My property is defined as follows:
<Property Id="INSTALLSCOPE" Secure="yes" />
My install directory definitions are as follows:
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id= 'INSTALLSCOPE' Name='AppData'>
<Directory Id='MYAPP' Name='COMPANY'>
<Directory Id='INSTALLDIR' Name='MyApp'>
My radio buttons are as follows:
<Dialog Id="CustomInstallScopeDlg" Width="370" Height="270" Title="[ProductName] Install Scope"
NoMinimize="yes">
<Control Id="RadioButtonGroupID" Type="RadioButtonGroup" X="30" Y="94" Width="305" Height="100" Property="INSTALLSCOPE">
<RadioButtonGroup Property="INSTALLSCOPE">
<RadioButton Value="LocalAppDataFolder" X="0" Y="0" Width="300" Height="10" Text="SingleUser"/>
<RadioButton Value="ProgramFilesFolder" X="0" Y="20" Width="300" Height="10" Text="AllUser"/>
</RadioButtonGroup>
</Control>
...
After the radio buttons are changed and NEXT button is clicked, the following happens:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes"
Text="[ButtonText_Next]">
<Publish Property="INSTALLSCOPE" Value="LocalAppDataFolder">INSTALLSCOPE = "LocalAppDataFolder"</Publish>
<Publish Property="INSTALLSCOPE" Value="ProgramFilesFolder">INSTALLSCOPE = "ProgramFilesFolder"</Publish>
</Control>
Currently whats happening when I run it is it tries to install in E:AppData, instead of the correct AppData folder. Also the installer bugs out and the UI doesnt show. This doesnt happen if I hardcode the value LocalAppDataFolder instead of passing it through a variable. I ran a log on the install process and I can see the value of INSTALLSCOPE being changed as I go through the installer but the UI never updates to reflect this change and neither does the actual installation path ever change. Any help would be great.
Add a SetTargetPath event:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes"
Text="[ButtonText_Next]">
<Publish Property="INSTALLSCOPE" Value="LocalAppDataFolder">INSTALLSCOPE = "LocalAppDataFolder"</Publish>
<Publish Property="INSTALLSCOPE" Value="ProgramFilesFolder">INSTALLSCOPE = "ProgramFilesFolder"</Publish>
<Publish Event="SetTargetPath" Value="INSTALLSCOPE">1</Publish>
</Control>

Using a condition to make changes to the Windows firewall in WIX

I am trying to make changes to the Windows firewall based on a property that is set in a dialog. I can see in the log that the property is being set correctly but the firewall rules are being created regardless of the value of the property.
My code is...
<Component Id="ChangeFirewall" Guid="*" KeyPath="yes">
<Condition><![CDATA[ChgFirewall = "True"]]></Condition>
<fire:FirewallException Id="FW6501" Name="6501" Port="6501"
Protocol="tcp" Scope="any"/>
<fire:FirewallException Id="FW6502" Name="6502" Port="6502"
Protocol="tcp" Scope="any"/>
<fire:FirewallException Id="FW6505" Name="6505" Port="6505"
Protocol="tcp" Scope="any"/>
</Component>
If ChgFirewall is False why does the firewall get changed?
Update: I have added the code for the dialog that sets the CHGFIREWALL property...
<Dialog Id="FirewallDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="Description" Type="Text" X="20" Y="20" Width="280" Height="40" Transparent="yes" NoPrefix="yes">
<Text>This program uses TCP ports 6501, 6501, and 6505 for coordinating information between workstations. These ports must be unblocked for it to work correctly</Text>
</Control>
<Control Id="Instructions" Type="Text" X="20" Y="70" Width="280" Height="30" Transparent="yes" NoPrefix="yes">
<Text>This installer can attempt to automatically modify the Windows Firewall for you, or you may manually modify the firewall settings.</Text>
</Control>
<Control Type="RadioButtonGroup" Property="CHGFIREWALL" Id="CHGFIREWALL" Width="340" Height="44" X="20" Y="120">
<RadioButtonGroup Property="CHGFIREWALL">
<RadioButton Text="Have the installer update the firewwall settings for Guru (Recommended)" Height="13" Value="True" Width="340" X="0" Y="0" />
<RadioButton Text="Manually update the firewall settings" Height="13" Value="False" Width="340" X="0" Y="15" />
</RadioButtonGroup>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
<Publish Event="EndDialog" Value="Return"></Publish>
</Control>
<Control Id="CancelButton" Type="PushButton" Text="Cancel" Height="17" Width="56" X="180" Y="243" Cancel="yes">
<Publish Event="EndDialog" Value="Exit" />
</Control>
</Dialog>
Also this is my definition of the property...
<Property Id='CHGFIREWALL' Value='False' Secure='yes'/>
As a first step, UPPERCASE the property and set the attribute 'secure="yes". This ensures that the property is passed properly to the server process as explained in the comments here.
Then the issue is how you set the property? Is is set by a custom action, or do you set it in the Property table or on the command line?

WIX radio button group

I am stuck in doing with WIX radio group button,I want to know
Whether i can able to disable text box based on selection of WIX radio group button like mentioned in the image below.
And how is it possible to save selection of radio group button value.As i needed the selected radio box value and save in registry.
for registry is it possible to assign the 1st text box value based on this condition?
<Condition><![CDATA[if (RADIOGROUP=1)<Property Id="RADIOGROUP" Value="[TEXTBOX1]" />]]></Condition>
<RegistryKey Root="HKLM" Key="SOFTWARE\Company\Service" >
<RegistryValue Name="RADIOGROUP" Value="[RADIOGROUP]" Type="string" >
</RegistryKey>
Can anyone help me.
Assuming you have your Radio Button as following:
<RadioButtonGroup Property="SOME_PROPERTY">
<RadioButton Value="0" Text="disable / hide labels" />
<RadioButton Value="1" Text="enable / show labels" />
</RadioButtonGroup>
you can control visibility or availablility of other elements in the dialog by using Condition sub-element:
<Control Id="SomeLabel" Type="Text" Text="text:">
<Condition Action="disable"><![CDATA[SOME_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[SOME_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="SomeLabel2" Type="Text" Text="text2:">
<Condition Action="hide">SOME_PROPERTY = "0"></Condition>
<Condition Action="show">SOME_PROPERTY = "1"></Condition>
</Control>
Following the request in comments, posting an example of updating property with values of Edit elements (some required control attributes are ommited for clarity):
<CustomAction Id="CA_SET_TO_A" Property="P" Value="[AA]" />
<CustomAction Id="CA_SET_TO_B" Property="P" Value="[BB]" />
<Dialog Id="MyDialog" Title="[ProductName] Setup">
<Control Id="Next" Type="PushButton" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="DoAction" Value="CA_SET_TO_A">R="USE_A"</Publish>
<Publish Event="DoAction" Value="CA_SET_TO_B">R="USE_B"</Publish>
</Control>
<Control Id="MyRadioButton" Type="RadioButtonGroup" Property="R">
<RadioButtonGroup Property="R">
<RadioButton Value="USE_A" Text="Save text field 1" />
<RadioButton Value="USE_B" Text="Save text field 2" />
</RadioButtonGroup>
</Control>
<Control Id="A" Type="Edit" Property="AA" Text="{64}">
<Condition Action="disable">R="USE_B"</Condition>
<Condition Action="enable">R="USE_A"</Condition>
</Control>
<Control Id="B" Type="Edit" Property="BB" Text="{64}">
<Condition Action="disable">R="USE_A"</Condition>
<Condition Action="enable">R="USE_B"</Condition>
</Control>
</Dialog>