eddyuk
eddyuk

Reputation: 4190

Setting property value from another properties

I have a custom control (disabled edit) where I want to show current logged in Domain\User.

I set property like this:

<Property Id="PROP_DOMAINUSER" Value="[%USERDOMAIN]\[LogonUser]"></Property>

But what I see in edit box is exact text - [%USERDOMAIN]\[LogonUser] and not actual domain and user.

How do I initialize property value from another property then?

Upvotes: 7

Views: 15027

Answers (1)

David Martin
David Martin

Reputation: 12248

You need to create a type 51 custom action to set the property, this can be achieved using the SetProperty element. Remember to schedule this before your custom control gets displayed.

<SetProperty Id="INSTALL_USERNAME" Value="[%USERDOMAIN]\[%USERNAME]" /> 

You should then use the property [INSTALL_USERNAME] in your control.

Edit:

To schedule the custom action use the Before or After attribute, if you are unsure where to schedule it use a tool like orca to see what order things are happening in, here's an example of the custom action running after After="InstallInitialize"

<SetProperty Id="INSTALL_USERNAME" Value="[%USERDOMAIN]\[%USERNAME]" After="InstallInitialize" /> 

Upvotes: 12

Related Questions