Thanks for the detailed response. I read over the MSDN overview 3 times, but
it still wasn't really clicking for me. Unfortunately, the Windows Installer
docs seem to discuss everything at the abstract level, but really lack in the
way of real world examples. For example, figuring out what the Attribute
property means when subscribing to an event, or what you'd use it for is pretty
elusive. I suspected it references the property on the subscribing control
that needs to be updated when the event fires, but I've seen it used in ways
that cause me to question that assumption.
What I've found I can do is have a CustomAction modify a property (which
doesn't trigger windows installer) but then publish the property value to
itself like this
<Publish Property=Foo Value=[Foo]>1</Publish>
This seems to trick Windows Installer into re-evaluating the value of that
property. Then I have a bunch of text controls with conditions that show/hide
them depending on the resultant value. This mostly gives me what I'm looking
for.
The one thing I can't do (and didn't mention below) is actually changing the
Windows Installer UI while still in the CA. Imagine a CA that takes a while,
and you want to update some progress text on the UI. I don't think the CA can
trigger this, and I can't come up with any clever way to create a loop of
Publish entries so could repeatedly call a CA that is monitoring some
background task until it's done. All of that said, the approach I discuss
above does appear good enough. I noticed that you can call Session.Message
object to send a record of type msiMessageTypeActionData. I have no idea if
that will do what I want, but I might try it after I get the basics nailed, and
see if it's the magic I'm looking for. It may have the same limitation you
mention below with MsiProcessMessage.
Thanks again!
-Dan
-----Original Message-----
From: Blair [mailto:[email protected]]
Sent: Friday, October 23, 2009 1:16 AM
To: 'General discussion for Windows Installer XML toolset.'
Subject: Re: [WiX-users] Using a CustomAction to modify a dialog
MSDN's overview is here: http://msdn.microsoft.com/library/aa368036.aspx
A control can both publish (send out) and subscribe to (receive from others)
events. However, not all controls can do both, and what they can do varies by
control, by event, and by whether they are reporting or listening.
Further, you can publish to an event OR a property.
Publishing a property means that when the control would have fired that event,
some property is set to the event's value.
Publishing an event means "shouting out: Hey, xyz(abc) just happened!" where
xyz is the event name and abc is the event value.
Subscribing to an event hooks some control's attribute to an event, such that
when that event is published, that control's attribute will be set to the
event's value.
Some events have built-in listeners, others don't. All of the documented
defined events are listed on this page:
http://msdn.microsoft.com/library/aa368043.aspx
Since I don't use internal UI all that much, I forgot you can't call
MsiProcessMessage from a custom action called via DoAction from an event.
So, the only thing you can do with your custom action is change properties.
Properties used for conditions are only evaluated when the dialog is first
populated, so the only way to "refresh" the dialog is to replace the dialog
with itself (assuming that can be done, which I don't honestly know). You would
have to use the same event that calls your custom action with a later order
value so that the activity that subscribes to that event runs after your custom
action has completed.
The event mapping is "set", so typically what happens is you get the following
kind of model:
You can use some event from some control to fire your CA, which evaluates and
sets a property.
That same event can then trigger a pop-up dialog based on your property if you
are reporting an error condition, which returns to your dialog when the user
acknowledges it and tries again.
That same event can move to another dialog based on another state of your
property, for example, you passed validation.
The above model is a type of PID validation sample I remember from the SDK a
while back, but I am having trouble finding just where I found it before.
When/if I find it, I will show what the markup looks like to implement it. I
know it isn't just like what you are looking for, but we have said before that
the internal UI is quite limited. There are a whole other set of limitations on
the external and embedded UIs, but we don't live in a perfect world, apparently.
-----Original Message-----
From: Dan Giambalvo [mailto:[email protected]]
Sent: Thursday, October 22, 2009 4:07 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Using a CustomAction to modify a dialog
I'm sorry, I'm having trouble wrapping my head around how this subscribe model
works, and also difficulty figuring out how to fire the appropriate events from
within the CustomAction (currently in VBScript.) Can you possibly offer a
small bit of XML to demonstrate your thinking?
-----Original Message-----
From: Blair [mailto:[email protected]]
Sent: Thursday, October 22, 2009 3:10 PM
To: 'General discussion for Windows Installer XML toolset.'
Subject: Re: [WiX-users] Using a CustomAction to modify a dialog
I've never tried this, but if the text control subscribes to the actiondata
event, could your custom action send an actiondata event to it?
Let us know how that works.
-----Original Message-----
From: Dan Giambalvo [mailto:[email protected]]
Sent: Thursday, October 22, 2009 2:56 PM
To: [email protected]
Subject: [WiX-users] Using a CustomAction to modify a dialog
I'm trying to use a CustomAction to do some evaluation, and modify an on-screen
Windows Installer dialog. The scenario is this:
1) User enters some text in an edit control
2) User clicks a button which invokes a custom action to evaluate the
entered text
3) Custom action completes, and some new text is shown to the user *in
the same dialog*
I've envisioned two ways of building this:
1) (ideal) Some Text Control lives on the dialog with Text= some
property. The CustomAction modifies the property value, and the text control
displays the new value.
2) I create a text control for each possible string I want to show all
overlapping. The CustomAction either hides/shows the appropriate control, or
sets some property which triggers a bunch of show/hide Conditions on each text
control.
The problem I'm running into is that I can't seem to get Windows Installer to
re-evaluate any properties after the custom action ends. For example, I have a
button that runs my custom action and it changes the property, but the UI
doesn't update. If I spawn a dialog however (by hitting cancel for
example) then the UI updates.
Does anyone know of a clever way to tickle Windows Installer into re-evaluating
properties after the CustomAction ends?
Thanks
-Dan
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the
only developer event you need to attend this year. Jumpstart your developing
skills, take BlackBerry mobile applications to market and stay ahead of the
curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
----------------------------------------------------------------------------
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users