This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: ControlEvent not recognizing property change immediately
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 02, 2011
04:45 PM
ControlEvent not recognizing property change immediately
I have created a custom dialog for a user to enter a database name. When the user clicks Next on the dialog, I want to validate the name entered to ensure it does not contain invalid characters, so I added an InstallScript function to do the validation and set a property, then added a custom action to call the function. I added an event to the Next button (DoAction) and link it to my custom action with a condition of "1". This action is the first action (bottom of the list). This process is working great. The validation sets the property DBNAME_INVALID to "1" if the name contains invalid characters and sets it to "0" otherwise. I actually reset this property to "-1" at the beginning of the function just to make sure it was getting changed. My log file shows this is working as expected. Immediately following (above) this event I added a SpawnDialog event to display an error message dialog and set its condition to DBNAME_INVALID="1". However, the Ready to Install dialog gets displayed instead of my message dialog, as if the property was set to "0"!
Action 15:08:38: SelectSettings. Dialog created
MSI (c) (B0:FC) [15:08:41:799]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (B0:FC) [15:08:41:877]: Doing action: ValidateDatabaseName
Action 15:08:41: ValidateDatabaseName.
Action start 15:08:41: ValidateDatabaseName.
MSI (c) (B0:F0) [15:08:41:893]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIF122.tmp, Entrypoint: f12
MSI (c) (B0!F0) [15:08:42:284]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (B0!F0) [15:08:42:284]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 15:08:42: ValidateDatabaseName. Return value 1.
Action 15:08:42: ReadyToInstall. Dialog created
If I click the Back button on the Ready to Install dialog, then click Next on my custom dialog again, the validation happens again and correctly sets the property, but this time the error message dialog is displayed as expected!
Action 15:08:55: SelectSettings. Dialog created
MSI (c) (B0:FC) [15:08:56:242]: Doing action: ValidateDatabaseName
Action 15:08:56: ValidateDatabaseName.
Action start 15:08:56: ValidateDatabaseName.
MSI (c) (B0:A4) [15:08:56:257]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSI294B.tmp, Entrypoint: f12
MSI (c) (B0!A8) [15:08:56:742]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (B0!A8) [15:08:56:742]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 15:08:56: ValidateDatabaseName. Return value 1.
Action 15:08:56: InvalidDatabaseName. Dialog created
However, if I change the database name to a valid name and click Next, the validation properly sets the property to "0" as expected, but the error message but is still displayed!
MSI (c) (B0:FC) [15:09:53:570]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database$'. Its new value: 'database'.
MSI (c) (B0:FC) [15:09:55:085]: Doing action: ValidateDatabaseName
Action 15:09:55: ValidateDatabaseName.
Action start 15:09:55: ValidateDatabaseName.
MSI (c) (B0:E0) [15:09:55:101]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIF28.tmp, Entrypoint: f12
MSI (c) (B0!40) [15:09:55:585]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (B0!40) [15:09:55:585]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 15:09:55: ValidateDatabaseName. Return value 1.
Action 15:09:55: InvalidDatabaseName. Dialog created
So, it appears the SpawnDialog event is actually seeing the PREVIOUS value of DBNAME_INVALID instead of the CURRENT value! What else can I do to ensure that the current value of the property is used? Is there some sort of "flush" mechanism that should be called after MsiSetProperty()?
Action 15:08:38: SelectSettings. Dialog created
MSI (c) (B0:FC) [15:08:41:799]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (B0:FC) [15:08:41:877]: Doing action: ValidateDatabaseName
Action 15:08:41: ValidateDatabaseName.
Action start 15:08:41: ValidateDatabaseName.
MSI (c) (B0:F0) [15:08:41:893]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIF122.tmp, Entrypoint: f12
MSI (c) (B0!F0) [15:08:42:284]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (B0!F0) [15:08:42:284]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 15:08:42: ValidateDatabaseName. Return value 1.
Action 15:08:42: ReadyToInstall. Dialog created
If I click the Back button on the Ready to Install dialog, then click Next on my custom dialog again, the validation happens again and correctly sets the property, but this time the error message dialog is displayed as expected!
Action 15:08:55: SelectSettings. Dialog created
MSI (c) (B0:FC) [15:08:56:242]: Doing action: ValidateDatabaseName
Action 15:08:56: ValidateDatabaseName.
Action start 15:08:56: ValidateDatabaseName.
MSI (c) (B0:A4) [15:08:56:257]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSI294B.tmp, Entrypoint: f12
MSI (c) (B0!A8) [15:08:56:742]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (B0!A8) [15:08:56:742]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 15:08:56: ValidateDatabaseName. Return value 1.
Action 15:08:56: InvalidDatabaseName. Dialog created
However, if I change the database name to a valid name and click Next, the validation properly sets the property to "0" as expected, but the error message but is still displayed!
MSI (c) (B0:FC) [15:09:53:570]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database$'. Its new value: 'database'.
MSI (c) (B0:FC) [15:09:55:085]: Doing action: ValidateDatabaseName
Action 15:09:55: ValidateDatabaseName.
Action start 15:09:55: ValidateDatabaseName.
MSI (c) (B0:E0) [15:09:55:101]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIF28.tmp, Entrypoint: f12
MSI (c) (B0!40) [15:09:55:585]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (B0!40) [15:09:55:585]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 15:09:55: ValidateDatabaseName. Return value 1.
Action 15:09:55: InvalidDatabaseName. Dialog created
So, it appears the SpawnDialog event is actually seeing the PREVIOUS value of DBNAME_INVALID instead of the CURRENT value! What else can I do to ensure that the current value of the property is used? Is there some sort of "flush" mechanism that should be called after MsiSetProperty()?
(7) Replies
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 03, 2011
09:21 AM
ACordner wrote:
...
I added an event to the Next button (DoAction) and link it to my custom action with a condition of "1". This action is the first action (bottom of the list).
...
Hi ACordner
First action on top of the list.
Kevin
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 03, 2011
01:18 PM
I was having trouble getting other custom actions to do what I wanted previously, then I found somewhere (don't have the reference now) that the actions were executed from bottom up! I thought that was strange, but after reversing the order, my actions started to work! Maybe I just had some logic wrong somewhere.
However, after placing the DoAction - ValidateDatabaseName() action at the top and the SpawnDialog action second, the dialog NEVER appears!
Action 12:02:04: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:06:952]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (8C:E4) [12:02:07:702]: Doing action: ValidateDatabaseName
Action 12:02:07: ValidateDatabaseName.
Action start 12:02:07: ValidateDatabaseName.
MSI (c) (8C:E8) [12:02:07:718]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIA469.tmp, Entrypoint: f12
MSI (c) (8C!48) [12:02:08:077]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!48) [12:02:08:077]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 12:02:08: ValidateDatabaseName. Return value 1.
Action 12:02:08: DatabaseFolder. Dialog created
Action 12:02:09: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:11:984]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database$'. Its new value: 'database'.
MSI (c) (8C:E4) [12:02:12:109]: Doing action: ValidateDatabaseName
Action 12:02:12: ValidateDatabaseName.
Action start 12:02:12: ValidateDatabaseName.
MSI (c) (8C:58) [12:02:12:124]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIB5A0.tmp, Entrypoint: f12
MSI (c) (8C!70) [12:02:12:452]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (8C!70) [12:02:12:452]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 12:02:12: ValidateDatabaseName. Return value 1.
Action 12:02:12: DatabaseFolder. Dialog created
Action 12:02:13: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:15:405]: Doing action: ValidateDatabaseName
Action 12:02:15: ValidateDatabaseName.
Action start 12:02:15: ValidateDatabaseName.
MSI (c) (8C:44) [12:02:15:421]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIC282.tmp, Entrypoint: f12
MSI (c) (8C!40) [12:02:15:796]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!40) [12:02:15:796]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 12:02:15: ValidateDatabaseName. Return value 1.
Action 12:02:15: DatabaseFolder. Dialog created
Action 12:02:16: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:18:421]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (8C:E4) [12:02:19:140]: Doing action: ValidateDatabaseName
Action 12:02:19: ValidateDatabaseName.
Action start 12:02:19: ValidateDatabaseName.
MSI (c) (8C:9C) [12:02:19:155]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSID119.tmp, Entrypoint: f12
MSI (c) (8C!F8) [12:02:19:515]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!F8) [12:02:19:515]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 12:02:19: ValidateDatabaseName. Return value 1.
Action 12:02:19: DatabaseFolder. Dialog created
However, after placing the DoAction - ValidateDatabaseName() action at the top and the SpawnDialog action second, the dialog NEVER appears!
Action 12:02:04: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:06:952]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (8C:E4) [12:02:07:702]: Doing action: ValidateDatabaseName
Action 12:02:07: ValidateDatabaseName.
Action start 12:02:07: ValidateDatabaseName.
MSI (c) (8C:E8) [12:02:07:718]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIA469.tmp, Entrypoint: f12
MSI (c) (8C!48) [12:02:08:077]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!48) [12:02:08:077]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 12:02:08: ValidateDatabaseName. Return value 1.
Action 12:02:08: DatabaseFolder. Dialog created
Action 12:02:09: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:11:984]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database$'. Its new value: 'database'.
MSI (c) (8C:E4) [12:02:12:109]: Doing action: ValidateDatabaseName
Action 12:02:12: ValidateDatabaseName.
Action start 12:02:12: ValidateDatabaseName.
MSI (c) (8C:58) [12:02:12:124]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIB5A0.tmp, Entrypoint: f12
MSI (c) (8C!70) [12:02:12:452]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '1'. Its new value: '-1'.
MSI (c) (8C!70) [12:02:12:452]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 12:02:12: ValidateDatabaseName. Return value 1.
Action 12:02:12: DatabaseFolder. Dialog created
Action 12:02:13: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:15:405]: Doing action: ValidateDatabaseName
Action 12:02:15: ValidateDatabaseName.
Action start 12:02:15: ValidateDatabaseName.
MSI (c) (8C:44) [12:02:15:421]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSIC282.tmp, Entrypoint: f12
MSI (c) (8C!40) [12:02:15:796]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!40) [12:02:15:796]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '0'.
Action ended 12:02:15: ValidateDatabaseName. Return value 1.
Action 12:02:15: DatabaseFolder. Dialog created
Action 12:02:16: SelectSettings. Dialog created
MSI (c) (8C:E4) [12:02:18:421]: PROPERTY CHANGE: Modifying DBNAME property. Its current value is 'database'. Its new value: 'database$'.
MSI (c) (8C:E4) [12:02:19:140]: Doing action: ValidateDatabaseName
Action 12:02:19: ValidateDatabaseName.
Action start 12:02:19: ValidateDatabaseName.
MSI (c) (8C:9C) [12:02:19:155]: Invoking remote custom action. DLL: C:\Users\acordner\AppData\Local\Temp\MSID119.tmp, Entrypoint: f12
MSI (c) (8C!F8) [12:02:19:515]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '0'. Its new value: '-1'.
MSI (c) (8C!F8) [12:02:19:515]: PROPERTY CHANGE: Modifying DBNAME_INVALID property. Its current value is '-1'. Its new value: '1'.
Action ended 12:02:19: ValidateDatabaseName. Return value 1.
Action 12:02:19: DatabaseFolder. Dialog created
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 05, 2011
05:37 PM
It will probably easier if you can post a screenshot of the control events.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2011
02:34 PM
Looks like I found the answer to my question in this post by Luke Surace:
http://www.ureader.com/msg/1653324.aspx
He states:
...you're correct that the property changes set by a custom
action are not "noticed" by the processing of the ControlEvent table
unless those properties are mentioned in the ControlEvent table. The
workaround is to do this:
DoAction MyAction 1
[MyProperty] [MyProperty] 1
SpawnDialog CancelSetup MyProperty=1
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp
http://www.ureader.com/msg/1653324.aspx
He states:
...you're correct that the property changes set by a custom
action are not "noticed" by the processing of the ControlEvent table
unless those properties are mentioned in the ControlEvent table. The
workaround is to do this:
DoAction MyAction 1
[MyProperty] [MyProperty] 1
SpawnDialog CancelSetup MyProperty=1
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2011
04:37 PM
Another thing thing to note... if you have two ControlEvents, a NewDialog and a SpawnDialog, and both of their conditions evaluate to True, the NewDialog event takes precedence over the SpawnDialog event.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2011
06:55 PM
What's the order of NewDialog and SpawnDialog? According to ControlEvent Table , If multiple NewDialog and SpawnDialog control events are selected for the same control, only the event with the largest value in the Ordering column gets published when the control is activated.
ACordner wrote:I don't think Luke's reply was correct. I was able to set a public property in a C# custom action (the type of CA shouldn't matter) triggered by Next button's control event, and used the same public property to control dialog flow (SpawnDialog and multiple NewDialog), when I got the ordering correct.
Another thing thing to note... if you have two ControlEvents, a NewDialog and a SpawnDialog, and both of their conditions evaluate to True, the NewDialog event takes precedence over the SpawnDialog event.
ACordner wrote:
Looks like I found the answer to my question in this post by Luke Surace:
http://www.ureader.com/msg/1653324.aspx
He states:
...you're correct that the property changes set by a custom
action are not "noticed" by the processing of the ControlEvent table
unless those properties are mentioned in the ControlEvent table. The
workaround is to do this:
DoAction MyAction 1
[MyProperty] [MyProperty] 1
SpawnDialog CancelSetup MyProperty=1
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 07, 2011
09:19 AM
The original order of the events was:
DoAction
SpawnDialog
NewDialog
NewDialog
NewDialog
NewDialog
Now that I have changed the conditions on all of the NewDialog events to evaluate to False if the condition for SpawnDialog evaluates to True, I was able to remove the [MyProperty] event (which was immediately after DoAction), and it works as you suggested. So the key to this problem was that multiple event's conditions evaluated to True, and according to what you said, the one with the highest order number (meaning the closest to the last event in the list, right?) is executed. Making sure only one of the NewDialog/SpawnDialog events evaluates to True seems to be the way to avoid this issue.
Thanks for all your help!
DoAction
SpawnDialog
NewDialog
NewDialog
NewDialog
NewDialog
Now that I have changed the conditions on all of the NewDialog events to evaluate to False if the condition for SpawnDialog evaluates to True, I was able to remove the [MyProperty] event (which was immediately after DoAction), and it works as you suggested. So the key to this problem was that multiple event's conditions evaluated to True, and according to what you said, the one with the highest order number (meaning the closest to the last event in the list, right?) is executed. Making sure only one of the NewDialog/SpawnDialog events evaluates to True seems to be the way to avoid this issue.
Thanks for all your help!