Oleksii
Oleksii

Reputation: 1549

WIX installer - pass variable to the next window

I'm trying to implement the next scenario: 'Welcome dialog' -> 'Service name dialog' -> 'Installation path dialog'

Service name dialog is a custom one. User is supposed to input the name of the service and after pressing 'Next' button - at the 'Installation path dialog' shoul appear default path like ".....\inserted_value_on_previous_window".

At 'Service name dialog' I have Edit Control implemented like:

<Control Id="ServiceValueEdit" Type="Edit" X="15" Y="60" Width="200" Height="15" Property="WIXUI_SELECTEDSERVICENAME" Indirect="yes" />

So it is supposed to set WIXUI_SELECTEDSERVICENAME property. For setting default installation path at 'Installation path dialog' I use code like:

<Property Id="WIXUI_SELECTEDSERVICENAME" Value="SELECTEDSERVICENAME"></Property>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>  

<SetDirectory Id="INSTALLDIR" Value="[DEFIISFOLDER]\[WIXUI_SELECTEDSERVICENAME]" Sequence="both"></SetDirectory>

But, unfortunately, when we go to 'Servic name dialog' and set any value - it does not get reflected on the next screen. The next window will alvays have default value SELECTEDSERVICENAME. What I think it gets set just one at the compilation time and does not get updated during the runtime.

Can anyone help to fugure out how it is possible to get this value be set from one window and being ransferred to the next one? Thank you.

To be clear here are the couple of screenshots: Service name dialog

So what I want to do is to make the dialog below this string contain 'name' (as shown on the picture abowe) instead of 'SELECTEDSERVICENAME' as listed below.

enter image description here

Upvotes: 2

Views: 1477

Answers (1)

Brian Sutherland
Brian Sutherland

Reputation: 4798

You are setting the value of INSTALLDIR to [DEFIISFOLDER][WIXUI_SELECTEDSERVICENAME] during the initial setup of the install. That means you are using the initial value of WIXUI_SELECTEDSERVICENAME when setting the INSTALLDIR property.

You need to publish an event when you switch UI pages which will update the installdir.

I think something similar to:

<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
  <Publish Property="INSTALLDIR" Value="[DEFIISFOLDER]\[WIXUI_SELECTEDSERVICENAME]">1</Publish>
</Control>

would update the INSTALLDIR property with the new WIXUI_SELECTEDSERVICENAME value.

Upvotes: 2

Related Questions