PDA

View Full Version : Custom Action needs to refresh current dialog



Simeon Pilgrim
07-11-2006, 01:01 AM
In a Basic MSI project

I have a custom action to call a .dll to check serial numbers are correct. The custom action works and the variable/property gets updated fine, but the UI does not.

I have a condition on the next button's NewDialog event and an enable/disable pair on the next button's Conditions, as is done with the LicenseAgreement dialog.

If I press back then next, the next button is now enabled, and can be pressed.

It's like the custom action is not generating a changed event on the return value property.

So going forward, is there anyway to trigger page refresh?

Cheers Simeon

TsungH
07-11-2006, 11:01 PM
Which control fires off your custom action? Did you check with installation log (with /l*v switch)?

Simeon Pilgrim
07-12-2006, 12:31 AM
Which control fires off your custom action?
Well I had in on two edit boxes, but to help with debugging the problem put it on a button.


Did you check with installation log (with /l*v switch)?
Where do I put that flag, and what would I be looking for?

TsungH
07-12-2006, 09:58 PM
Edit Control (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/edit_control.asp) does not publish DoAction ControlEvent (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/doaction_controlevent.asp).
Well I had in on two edit boxes, but to help with debugging the problem put it on a button.Please do a search on command line parameters at Macrovision Support (http://support.installshield.com/).
Where do I put that flag, and what would I be looking for?

Simeon Pilgrim
07-13-2006, 12:39 AM
Ok, thanks for the command line advice.

What happens when I put the valid authentication code and press the button is:


MSI (c) (48:2C) [17:04:40:050]: Doing action: SerialAuth
Action 17:04:40: SerialAuth.
Action start 17:04:40: SerialAuth.
MSI (c) (48:10) [17:04:40:066]: Invoking remote custom action. DLL: C:\DOCUME~1\spilgrim\LOCALS~1\Temp\MSI1C1.tmp, Entrypoint: DLL1
MSI (c) (48!6C) [17:04:40:081]: PROPERTY CHANGE: Modifying SerialAuthenticated property. Its current value is '0'. Its new value: '-1'.
Action ended 17:04:40: SerialAuth. Return value 1.

And then if I put an invalid code in I get


MSI (c) (48:2C) [17:04:42:917]: Doing action: SerialAuth
Action 17:04:42: SerialAuth.
Action start 17:04:42: SerialAuth.
MSI (c) (48:60) [17:04:42:932]: Invoking remote custom action. DLL: C:\DOCUME~1\spilgrim\LOCALS~1\Temp\MSI1C2.tmp, Entrypoint: DLL1
MSI (c) (48!CC) [17:04:42:948]: PROPERTY CHANGE: Modifying SerialAuthenticated property. Its current value is '-1'. Its new value: '0'.
Action ended 17:04:42: SerialAuth. Return value 1.

If I press the button many times I get the same responce without the SerialAuthenticated property change.

The code I have on the Enable/Disable Conditions was
Disable: SerialAuthenticated=0
Enable: SerialAuthenticated<>0

and I changed the enable to
SerialAuthenticated!=0
but this had no effect.

The dll is delphi code returning a long bool (32bit) so I am using a return type of NUMBER. while I'm surprised the bool value of TRUE is -1, but it still meets the != 0 rule.

Simeon Pilgrim
07-13-2006, 12:47 AM
Edit Control (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/edit_control.asp) does not publish DoAction ControlEvent (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/doaction_controlevent.asp).

Strange, because while debugging the MSI with the DoAction event on the Edit control, every time I pressed a key in the edit control (or tried leave the control), my debugger would break into my dll, so I am very sure it does fire the Event. But that a side, I changed to using only a button to trigger the dll call, to help with debugging.

TsungH
07-13-2006, 09:17 PM
I am not. If Edit control does publish DoAction event, Next button on the same dialog should be enabled when a valid code is entered.
so I am very sure it does fire the Event.

A common approach is to validate serial number when Next button is clicked. If it is good, go to the next dialog. Otherwise, display an error message and stay on the same dialog.

Simeon Pilgrim
07-13-2006, 10:04 PM
I am not. If Edit control does publish DoAction event, Next button on the same dialog should be enabled when a valid code is entered.
Well I agree that maybe the editbox dosen't do the eventing correctly, but my dll was getting called when I put my custom action as the thing todo for the DoAction on the Edit control.

If the control does not support the event, then InstallShield should not exposed it as a option.

But ethier way, the problem I am describing in this thread is when the DoAction event is on an blank button. Which I understand is supported. With the above log snippets above, it is clear that my variable is getting changed as a result of the DoAction event, so I would think this is a bug that the Next button is not changing state. as if you press Back, then Next the Next button is now enabled.



A common approach is to validate serial number when Next button is clicked. If it is good, go to the next dialog. Otherwise, display an error message and stay on the same dialog.

This is how our other products work, and I feel it is not as nice as the UI giving correct feedback (ie the Next button been enabled/diabled). What I want todo appears that it should work but doesn't. For this reason and others I have moved from a "Basic MSI" install project to a "InstallScript" project as this is how our other projects are done.

But if I did wanted my custon action to run before the NewDialog event that also would be wired to the Next button been pressed, how would I do that? Just put the DoAction event before the NewDialog event in vertical order?

TsungH
07-14-2006, 10:54 PM
It is documented in ControlEvent Table (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp) that PushButton Control, CheckBox Control, or SelectionTree Control are the only controls users can use to initiate control events. So, it is possible that Windows Installer suppresses events from other kinds of control.
Well I agree that maybe the editbox dosen't do the eventing correctly, but my dll was getting called when I put my custom action as the thing todo for the DoAction on the Edit control.That I agree.
If the control does not support the event, then InstallShield should not exposed it as a option.Perhaps, try using a public property, and insert a space after the property and before the string value in the condition.
With the above log snippets above, it is clear that my variable is getting changed as a result of the DoAction event, so I would think this is a bug that the Next button is not changing state. as if you press Back, then Next the Next button is now enabled.You will need to use ControlEvent Table (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/controlevent_table.asp).
But if I did wanted my custon action to run before the NewDialog event that also would be wired to the Next button been pressed, how would I do that? Just put the DoAction event before the NewDialog event in vertical order?

Simeon Pilgrim
07-16-2006, 05:38 PM
It is documented in ControlEvent Table that PushButton Control, CheckBox Control, or SelectionTree Control are the only controls users can use to initiate control events. So, it is possible that Windows Installer suppresses events from other kinds of control.

Well that would make sense then. Thanks for all your help, while I may have come across argumentative (from my frustration at it not working) I have really appreciated your insight and advice.

TsungH
07-17-2006, 12:41 AM
It's a healthy discussion. ;) Glad that I can help.