| InstallerContactSite Map |
Advanced Installer User Guide | |||
How do I refresh a dialog after setting a property? |
| Answer
This article explains how to refresh a dialog after modifying properties that were used on that dialog. With Enhanced UIIn order to initiate a refresh on an Enhanced UI Dialog, you only need to set the AiRefreshDlg property after your property has been updated. Each time AiRefreshDlg is being set, the user interface refreshes. Below is a sample VBScript that retrieves the value of MYPROP, increments it by one, then updates the property with the new value. Upon this modification, the dialog needs to be refreshed, so the AiRefreshDlg property is set to "1" (Note the conversion to a string by using "cstr")
Dim x
'Retrieve the value of MYPROP
x = Session.Property("MYPROP")
'Test if MYPROP is empty (i.e it does not already exist). If it is, initialize it
If x = "" Then
x = 0
Else
'Increment x
x = x+1
End If
'Write the incremented value back into MYPROP
Session.Property("MYPROP") = cstr(x)
'setting AiRefreshDlg refreshes the controls on a dialog when Enhanced UI is enabled
Session.Property("AiRefreshDlg") = cstr(1)
You can save the above script in a .vbs file and add it as a UI Cusom Action in Custom Actions page. You can then call it by placing a DoAction Published Event on a button. Make sure you also have a static text with the "Property" field set to "MYPROP" and the "Text" field set to "[MYPROP]" on the same page with your button, so you can see the updated value. Without Enhanced UIThe UpdateMsiEditControls Custom Action is responsible for refreshing an MSI Dialog. Described below is the proper usage of this custom action.
On the Published Events tab, add a new Published Event by pressing the [ New... ] button. Set the "Name" field to "DoAction" and the "Argument" to "UpdateMsiEditControls" on the "New Control Event" dialog. Use the [ Down ] button to the right to make sure the "UpdateMsiEditControls" event is below the event that sets the property.
|
