WIX toolbox How to set a property

It seems like it should be intuitive, but so far it hasn't been at all. How can I simply set the property I have defined in my product.wxs when the first custom dialog opens?

My Property is named "Port", which is initialized to empty. I have another "df_Port" which I set to "8080". (They are set in my Product.wxs) When my custom dialog opens, I want to set "Port" to "df_Port". I also have an Edit control in a dialog that has its Property set to Port. So obviously the user should be able to update the port, but if they hit the back button but eventually return to that dialog, the default for the edit control should be back to "8080"

I tried SetProperty but it requires a Before or After property and I don't know how to do it. I also tried to create a CustomAction, but that didn't work either:

<CustomAction Id="caPort" Property="Port" Value="[df_Port]"/>

      

The control is displayed as empty, not "8080"

I am using Wix 3.9 R2

+3


source to share


1 answer


No one answered or commented on my question. However, after much trial and error, I figured out the solution. I figured I'd put it here in case someone else had the same problem.

1) First, I have to name the properties like all Uppercase. So in my product.wxs I declare:

<Property Id="DF_PORT" Value="8080" Secure="yes"/>
<Property Id="PORT" Secure="yes"/>

      

2) Then I add the publish tag and attach to the Next button in the dialog preceding my custom config dialog:

<Publish Dialog="PrecedingDialogName" Control="Next" Property="PORT" Value="[DF_PORT]">1</Publish>

      



3) In my custom dialog, I just bind the Edit control to the PORT property:

<Control Id="Port" Type="Edit" X="130" Y="88" Width="60" Height="16" Property="PORT" Text="{\WixUI_Font_Normal}" Integer="yes" RightAligned="yes" />

      

The control displays the default value. If I edit the value, but then hit the Back button, Step 2 will reload the default instead of remembering what the user typed.

After working with the WIX Toolset for a couple of weeks, I can honestly say that this is one of the worst and most unintuitive developments I've ever seen!

+6


source







All Articles