Hyperlink and Button_Click not working in Wix MBA - wix

I am new to Wix Toolset. I am using v3.6 and using ManagedBootstrapperApplicationHost.
In my theme .xml file, one of the pages looks like this -
<Page Name="Install">
<Text X="11" Y="121" Width="400" Height="17" FontId="3">#(loc.InstallLicenseLabel)</Text>
<Hyperlink Name="eula" X="11" Y="138" Width="75" Height="17" TabStop="yes" FontId="4" HoverFontId="4" SelectedFontId="4">#(loc.InstallLicenseTerms)</Hyperlink>
<Button Name="InstallButton" X="-91" Y="-11" Width="130" Height="23" TabStop="yes" FontId="0">#(loc.InstallAcceptAndInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallDeclineButton)</Button></Page>
My problem is that I don't know where to add the reference source information for hyperlink. None of its attribute has this facility. Similarly, I am unable to associate event functions with buttons. Could any one please help me???
Thanks a lot in advance...

MSDN article on Hypelink control in MSI has an example:
Blue Yonder Airlines
So in WiX you would write something like:
<Hyperlink Name="eula"
X="11" Y="138" Width="75" Height="17" TabStop="yes">
<a href="http://yoursite.com/">Your Site</a>
</Hyperlink>
You can also add some descriptive text to the control if you like.
Read Control Your Controls section of WiX Tutorial to know how to add event handlers to buttons.
Windows Installer UI, and WiX correspondingly, is not very flexible. Yet it's enough for most installers.

Related

Is there any way to change Option and Install button color in standard boot strapper

I am using WIX theme file for my custom UI design. My requirement is to change "Install" and "Option" button color to green. IS there any tag for that
<Button Name="OptionsButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
I changed the font color but its not working
I'm assuming that you meant the background of the button to be green, and not the text. You really should look up the schema I referenced in a different question of yours: https://wixtoolset.org/documentation/manual/v3/xsd/thmutil/button.html.
Attribute
Description
ImageFile
Relative path to an image file to define an graphic button. The image must be 3x the height to represent the button in 3 states: unselected, hover, selected. Mutually exclusive with ImageResource and SourceX and SourceY attributes.
Note that v4 has high DPI support which changed some image handling so make sure to look up that documentation when moving to v4.

Wix toolset - how to right align text

I'm using a customized version of thmutil theme for my Wix installer. For various reasons I want to right-align two text boxes ().
I can set the right end of the boxes but I cannot align the text so that it appears right-aligned.
Is there a way to modify the theme to support setting text alignment to left|center|right?
I thnk of an atribute like RightAligned="yes".
<Text X="-11" Y="11" Width="190" Height="30" FontId="1" Visible="yes" DisablePrefix="yes">#(loc.Title)</Text>
<Text X="-11" Y="40" Width="120" Height="17" FontId="3" Visible="yes" DisablePrefix="yes" HideWhenDisabled="yes">#(loc.InstallVersion)</Text>
It is actually simple, but not directly documented. You can do it by adding the attribute HexStyle="00000002" to the Text element. This value corresponds to the Win32 constant SS_RIGHT which aligns a static text control content to the right.
Actually, you can do quite a lot of fancy stuff just with styles. Making borders, auto text ellipsis, and stuff...
For reference, here is a handy list of values for control styles and other constants: https://github.com/wine-mirror/wine/blob/master/include/winuser.rh. Of course you can also find this somewhere in the windows headers files.
I used RightAligned="yes" attribute to align value in Text control to the right. (Wix Toolset v3.11)
<Control Id="ErrorLabel" Type="Text" X="30" Y="221" Width="300" Height="10" RightAligned="yes" Text="{\WixUI_Font_Error}!(loc.MissingValueError)">
<Condition Action="hide" >NOT UI_VALUE_INVALID</Condition>
<Condition Action="show" >UI_VALUE_INVALID</Condition>
</Control>

How can I show a message after uninstalling a WiX Burn bundle?

How can I add a message to the successfully uninstalled page of a Burn bundle?
I am using HyperlinkSidebarLicense of the WiX standard bootstrapper application and use a copy of the default theme (at src\ext\BalExtension\wixstdba\Resources\HyperlinkSidebarTheme.xml):
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkSidebarLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
ThemeFile="Theme.xml"
LocalizationFile="Theme.wxl" />
</BootstrapperApplicationRef>
I then modified the Success page by adding a Text:
<Page Name="Success">
...
<Text Name="SuccessUninstallMessage" X="185" Y="110" Width="-11" Height="40"
FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.SuccessMessage)</Text>
...
</Page>
However the modified Success page is also shown during installation (in addition to uninstall), which I don't want.
How can I show a message only during uninstall on the Success page?
That's not supported in WixStdBA in WiX v3.x. WixStdBA has code to show different messages based on the action and it only does that for the header text (SuccessHeader, SuccessInstallHeader, SuccessRepairHeader, and SuccessUninstallHeader).
In WiX v4.0 (not yet in beta), themes can conditionally control the text shown without requiring supporting code in WixStdBA:
<Label X="0" Y="250" Width="-0" Height="20" FontId="1" Center="yes">
<Text Condition="WixBundleAction = 5">#(loc.SuccessInstallMessage)</Text>
<Text Condition="WixBundleAction = 6">#(loc.SuccessInstallMessage)</Text>
<Text Condition="WixBundleAction = 7">#(loc.SuccessRepairMessage)</Text>
<Text Condition="WixBundleAction = 3">#(loc.SuccessUninstallMessage)</Text>
</Label>

Show and enable reboot text and button after WiX bootstrapper chain

Basically, I want to allow the user to restart his/her machine easily after the setup chain is complete. Just using <ExitCode ... after the last chain element is no option for me, because I do not want to force the user to restart and my last element is a MsiPackage, I simply want to give the user the option to restart, very quick.
Of course I could implement this feature in the Msi itself, but I also found this in a theme file of the bootstrapper:
<Page Name="Success">
<Text X="186"
Y="80"
Width="-11"
Height="30"
FontId="2"
DisablePrefix="yes">#(loc.SuccessHeader)</Text>
<Button Name="LaunchButton"
X="-91"
Y="-11"
Width="75"
Height="23"
TabStop="yes"
FontId="0"
HideWhenDisabled="yes">#(loc.SuccessLaunchButton)</Button>
<Text Name="SuccessRestartText"
X="186"
Y="-51"
Width="-11"
Height="32"
FontId="3"
DisablePrefix="yes"
HideWhenDisabled="yes">#(loc.SuccessRestartText)</Text>
<Button Name="SuccessRestartButton"
X="-116"
Y="-11"
Width="100"
Height="23"
TabStop="yes"
FontId="0"
HideWhenDisabled="yes">#(loc.SuccessRestartButton)</Button>
<Button Name="SuccessCancelButton"
X="-11"
Y="-11"
Width="100"
Height="23"
TabStop="yes"
FontId="0">#(loc.SuccessCloseButton)</Button>
</Page>
You see, there is a RestartText and RestartButton. When removing HideWhenDisabled I could see the elements after the setup, but they are still disabled obviously.
While in the wxs file is a SupressRepair tag in the bal:WixStandardBootstrapperApplication node to disable and hide the repair button and function, there even must be any option to enable the reboot text, button and function.
I could not determine where to set this. So, how can I enable the reboot text and button after the setup in the bootstrapp application.
Thanks in advise.
Obviously, my solution was very easy and could be detected by myself when trying to reboot after MSI install:
When telling the MSI package to reboot after successful install by applying
<InstallExecuteSequence>
<ScheduleReboot After="InstallFinalize"/>
</InstallExecuteSequence>
to my wxs file of my MSI project it will not cause the MSI to restart after the setup in the setup chain. Instead of that it will give the bootstrapper any return code so it enables my reboot text and button on the end of the whole setup chain.
I did not expect the bootstrapper is so intelligent. Nice!

Wix: ImageFile attribute for Progressbar not working

in my setup project I'd like to customize the Progressbar and give it a different color. I use the default theme xml. This is the progress page i modified:
<Page Name="Progress">
<Image X="11" Y="20" Width="485" Height="300" ImageFile="logo.png" Visible="yes"/>
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ProgressHeader)</Text>
<Text X="11" Y="121" Width="70" Height="17" FontId="3" DisablePrefix="yes">#(loc.ProgressLabel)</Text>
<Text Name="OverallProgressPackageText" X="85" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OverallProgressPackageText)</Text>
<Progressbar ImageFile=".\test.bmp" Name="OverallCalculatedProgressbar" X="21" Y="168" Width="-21" Height="33" />
<Button Name="ProgressCancelButton" X="-11" Y="-11" Width="85" Height="23" TabStop="yes" FontId="0">#(loc.ProgressCancelButton)</Button>
</Page>
In the Progressbar tag, I added the ImageFile attribute. The file test.bmp is in the same directory as the theme.xml.
The ImageFile help says the following:
Relative path to an image file for the control. The image must be 4 pixels wide: left pixel is the left side of progress bar, left middle pixel is progress used, right middle pixel is progress unused, right pixel is right side of progress bar. Mutually exclusive with ImageResource and SourceX and SourceY attributes.
The bmp is 4 pixels wide (all pixels are black), but the progress bar is still the default windows color (Win7 with Aero: green). I neither use ImageResource nor SourceX and SourceY attributes (as the documentation requires).
Can anyone help me with this? Did I miss something, or did I misunderstood something?
Most likely thmutil is failing to load your .\test.bmp. Most likely the file is missing. If the file cannot be loaded, it silently skips the failure and will revert back to the system progress bar.
To ensure that the .\test.bmp can be found, I would first recommend removing from the .\ path and then ensure the file is included as a Payload in your BootstrapperApplication element. For example:
<Bundle ...>
<BootstrapperApplication SourceFile='path\to\ba.dll'>
<Payload SourceFile='path\to\custom.thm' />
<Payload SourceFile='path\to\test.bmp' />
</BoostrapperApplication>
</Bundle>
That will add the file test.bmp to the list of BootstrapperApplication payloads. If you are using wixstdba, it would look more like:
<Bundle ...>
<BootstrapperApplicationRef Id='WixStandardBootstrapperApplication.RtfLicense'>
<bal:WixStandardBootstrapperApplication ThemeFile='path\to\custom.thm' />
<Payload SourceFile='path\to\test.bmp' />
</BoostrapperApplication>
</Bundle>