Control Conditions only fire when I click the Cancel Button - Advanced Installer Community
alex90112005
Posts: 6
Joined: Fri Jan 23, 2015 8:58 pm

Control Conditions only fire when I click the Cancel Button

I have a TextBox whose Action is bound to Hide/Show based on a public property PROP1.

I have a button which calls a custom Action (deferred) (Call Function From Attached Native DLL) in which I set the PROP1 value to true or false.
The problem:
The TextBox does not show/hide until I click the cancel button or some other event in the UI that changes the focus (or something to that effect).
I have even tried calling "UpdateMsiEditControls" from the button along with the above-mentioned custom action, and no luck.

Why is this NOT working?

Need help quickly please.

Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Control Conditions only fire when I click the Cancel But

Hello,

I'm afraid I don't fully understand your scenario. Can you please send us the .aip (project file) to support at advancedinstaller dot com so we can check its settings?

Please keep in mind that in order to launch a custom action on a button push, the custom action must be added without sequence. Also, all custom actions without sequence are immediate custom actions.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alex90112005
Posts: 6
Joined: Fri Jan 23, 2015 8:58 pm

Re: Control Conditions only fire when I click the Cancel But

Yes,

I have a button push custom action which calls a .NET Custom Action.
In there, I am setting the following properties=>
Code:
{
session["PROP1"] = "True"; //doing it twice just in case
session.CustomActionData["PROP1"] = "True"; //doing it twice just in case
}

Then, in the UI, I have a TextBox which I want to show/hide based on this property (i.e.: If PROP1 = "True", then Show; PROP1 = "False", then Hide=> SIMPLE).
But the TextBox's Action does NOT FIRE when my Custom Action completes. Only when I perform some other operation; such as trying to exit the installer-> then the text box shows.

Why does this happen?

Please let me know if I need to make things clearer.
Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Control Conditions only fire when I click the Cancel But

Hello,

Please keep in mind this is the normal Windows Installer behavior. When setting a property within a custom action code its value will be updated, but the control conditions of dialog controls (e.g. edit text) won't be triggered as long as you either leave the current dialog or set the property through a "Set installer property value" control event.

Therefore, as a workaround, beside the "PROP1" property used by your control conditions you can use an auxiliary property (AUX_PROP) which will be set by your custom action to the values you want the "PROP1" property to be set. Then, in the published events list of your button you should have two events like this:
  • Event: Execute custom action
    Argument: <your custom action name>

    Event: Set installer property value
    Property: [PROP1]
    Argument: [AUX_PROP]
In this way after the custom action sets the "AUX_PROP" auxiliary property to a desired value, the "PROP1" property will be set to the same value as "AUX_PROP" and this will trigger the control conditions evaluation.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alex90112005
Posts: 6
Joined: Fri Jan 23, 2015 8:58 pm

Re: Control Conditions only fire when I click the Cancel But

This works! Thank you!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Control Conditions only fire when I click the Cancel But

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”