Question

I'm using the windows service dialog from Windows Installer XML CommonUi Extension.

I have a dark coloured banner bitmap behind the title text, so I want to change the colour of the title font. I tried adding this to my .wxs:

  <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="8" Blue="255" Red="255" Green="255" />

This works without the extension, but now I am using the extension I get this error:

The primary key 'WixUI_Font_Title' is duplicated in table 'TextStyle'. Please remove one of the entries or rename a part of the primary key to avoid the collision.

How can I change the font?


EDIT: I resolved this in a hacky way by adding a TextStyle to the UI section like this:

  <TextStyle Id="My_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" Blue="255" Red="255" Green="255" />

and then adding custom strings to the .wxl file which overwrite the originals with the same text but with the font setting too.

  <String Id="ProgressDlgTitleInstalling">{\My_Font_Title}Installing [ProductName]</String>
  <String Id="ProgressDlgTitleChanging">{\My_Font_Title}Changing [ProductName]</String>
  <String Id="ProgressDlgTitleRepairing">{\My_Font_Title}Repairing [ProductName]</String>
  <String Id="ProgressDlgTitleRemoving">{\My_Font_Title}Removing [ProductName]</String>

I'm adding a bounty to the question in the hope of finding the proper way to do it.

Was it helpful?

Solution

There's no way to override a TextStyle element at the moment. Either you keep your current way of doing things, or you execute an SQL query on the MSI post build to update the WixUI_Font_Title TextStyle entry.

There's a help page on executing SQL on an MSI under Execute SQL Statements in the MSI doc (doc\msi.chm if you have WiX installed). You could use the MSI API or DTF instead of a script, of course.

Your update statement would look something like:

UPDATE `TextStyle` SET `Color` = 16777215 WHERE `TextStyle` = 'WixUI_Font_Title'

The documentation has this to say on the Color column:

The value put in this column should be computed using the following formula: 65536 * blue + 256 * green + red, where red, green, and blue are each in the range of 0-255.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top