How do I format the text displayed in a WiX edit control that is displaying a Property value?

StackOverflow https://stackoverflow.com/questions/1408058

  •  05-07-2019
  •  | 
  •  

Question

I am attempting to display the value of a property retrieved from the registry in a text edit control, with some text appended to the end of the property value. However, only the value of the property is displayed.It seems as though my custom format string is being ignored. I need to be able to assign any user modification of this text back to the property, as it will be written to the registry and read when an uninstall is performed.

Product.wxs:

<Property Id="PRIMARYDBPATH" Secure="yes">
  <RegistrySearch
      Id="PrimaryDbPathSearchSql"
      Root="HKLM"
      Key="Software\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup"
      Name="SQLDataRoot"
      Type="raw"
  />
  <RegistrySearch
    Id="PrimaryDbPathSearch"
    Root="HKCU"
    Key="Software\My Company\My Product"
    Name="PrimaryDbPath"
    Type="raw" 
  />
</Property>

SetupConfigDialog.wxs:

<Control
  Id="DatabasePath"
  Type="Edit"
  X="45" Y="139"
  Width="220" Height="18"
  Property="PRIMARYDBPATH" 
  Text="[PRIMARYDBPATH]\Data\"
/>
Was it helpful?

Solution

I'm not an expert in UI but you might consider using a SetProperty element before your Control/@Id="DatabasePath" dialog is displayed to concat the "\Data\" on the PRIMARYDBPATH Property.

Off the top of my head, something like:

<SetProperty Id="PRIMARYDBPATH" Value="[PRIMARYDBPATH]\Data\" After="AppSearch"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top