9

I have two custom dialog boxes (plus the required ones ExitDlg, FatalErrorDlg, etc.), the first one sets a property using an Edit control and the second one shows this property using a Text control. Here is the meaningful code:

<Dialog Id="DialogA" ...>
  <Control Id="ControlEdit" Type="Edit" Property="MY_PROPERTY" .../>
  <Control Id="ControlNext" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
</Dialog>

And then the second dialog:

<Dialog Id="DialogB" ...>
  <Control Id="ControlText" Type="Text" Text="[MY_PROPERTY]" .../>
  <Control Id="ControlBack" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
  <Control Id="ControlNext" Type="PushButton" ...>
    <Publish Event="EndDialog" Value="Return" /></Control>
</Dialog>

And the action sequence:

<InstallUISequence>
   <Show Dialog="DialogA" Before="MyCustomAction" />
   <Custom Action="MyCustomAction" Before="DialogB" />
   <Show Dialog="DialogB" Before="ExecuteAction" />
</InstallUISequence>

The custom action changes the value of MY_PROPERTY. My problem is how to make the Back button in DialogBget back to DialogA. Using NewDialog is simple, but then I can't get the custom action to be executed between the dialogs, or can I?


edit - 2013-05-02

After the answer from @caveman_dick, I tried to change the DialogA almost like he said, but instead of using EndDialog, I changed to Action="NewDialog" Value="DialogB". But now the Custom Action isn't being called. If I remove the Publish event to go to next dialog, then the CA is called. If I leave as @caveman_dick said, I can't get back to DialogA from DialogB.


edit - 2013-05-02

After searching in book WiX 3.6: A Developer's Guide to Windows Installer XML, I found the following: "if you have more than one Publish event, they must have conditional statements as their inner text. Otherwise, all of the events simply won't be published."

So the answer from @caveman_dick is correct, except that you need to change to the following:

<Publish ...>1</Publish>
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Marlos
  • 1,927
  • 2
  • 22
  • 44

1 Answers1

15

Rather than scheduling the custom action in the InstallUISequence you can publish it on the button click:

<Dialog Id="DialogA" ...>
   <Control Id="ControlEdit" Type="Edit" Property="MY_PROPERTY" .../>
   <Control Id="ControlNext" Type="PushButton" ...>
       <Publish Event="DoAction" Value="MyCustomAction">1</Publish>
       <Publish Event="EndDialog" Value="Return">1</Publish>
   </Control>
</Dialog>

EDIT: The Publish element's condition needs to explicitly evaluate to true to run, so add "1" as the text of the Publish elements.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
caveman_dick
  • 6,302
  • 3
  • 34
  • 49
  • I tried your approach but the action isn't being called. Instead of using `EndDialog`, I'm using `NewDialog` to be able to get back. If I remove the event `NewDialog`, the action is called. – Marlos May 02 '13 at 13:50
  • As edited in question, you need to add the condition to get multiple events working, but your answer is partially correct and solves the problem. – Marlos May 02 '13 at 14:21
  • I was just about to edit the answer with that. I naughtily copy-pasted your code. Thanks for the recognition though! :) – caveman_dick May 02 '13 at 14:35