Let me apologize... I've been very busy at work lately, which is why I
might lag on replies...

Anyway, I'll give this one a shot.  If you find anything useful,
please add it to the wiki as it will probably help the next person.

First, one of the better places to see how to add a dialog to an msi
task is  the sample that adds a dialog to gather virtual directory
information.  It is located here:
http://nant.sourceforge.net/wiki/index.php/sample%20build%20file

There is another example where I remove the license dialog here:
http://nant.sourceforge.net/wiki/index.php/InstallTasks_Sample_RemoveLicenseDlg

Ok... now to my understanding of how dialogs work in msi databases:

<dialogs>
    <dialog name="UserCredentialDlg" hcenter="50" vcenter="50"
       width="360" height="150" attr="39"
       title="[ProductName] [Manufacturer] [ProductVersion]"
       firstcontrol="UserName"
       defaultcontrol="UserName" cancelcontrol="Cancel" />
</dialogs>

This defines the dialog frame.  It adds an entry to the Dialog table
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/dialog_table.asp)
so that the dialog can be used anywhere in the install.

<controls>
        <!-- Default header (similar on all dialogs) -->
    <control dialog="UserCredentialDlg" name="BannerBitmap" type="Bitmap"
        x="0" y="0" width="374" height="44" attr="1"
        text="[BannerBitmap]" nextcontrol="UserLabel" />
    <control dialog="UserCredentialDlg" name="Title" type="Text"
        x="15" y="6" width="200" height="15" attr="196611"
        text="[DlgTitleFont]User Credential Information" />
    <control dialog="UserCredentialDlg" name="Description" type="Text"
        x="25" y="23" width="280" height="15" attr="196611"
        text="Please enter your login information." />
    <control dialog="UserCredentialDlg" name="BannerLine" type="Line"
        x="0" y="44" width="374" height="0" attr="1" />

        <!-- Main dialog controls -->
    <control dialog="UserCredentialDlg" name="UserLabel" type="Text"
        x="18" y="73" width="128" height="15" attr="3"
        text="User:" nextcontrol="UserName" />
    <control dialog="UserCredentialDlg" name="UserName" type="Edit"
        x="18" y="85" width="252" height="18" attr="7"
        property="USERNAME"
        text="[USERNAME]"
        nextcontrol="PasswordLabel" />
    <control dialog="UserCredentialDlg" name="PasswordLabel" type="Text"
        x="18" y="110" width="128" height="15" attr="3"
        text="Password:"
        nextcontrol="Password" />
    <control dialog="UserCredentialDlg" name="Password" type="Edit"
        x="18" y="122" width="252" height="18" attr="2097159"
        property="PASSWORD"
        text="[PASSWORD]"
        nextcontrol="PasswordConfirmationLabel" />    
    <control dialog="UserCredentialDlg"
name="PasswordConfirmationLabel" type="Text"
        x="18" y="147" width="128" height="15" attr="3"
        text="Confirm Password:"
        nextcontrol="PasswordConfirmation" />
    <control dialog="UserCredentialDlg" name="PasswordConfirmation" type="Edit"
        x="18" y="159" width="252" height="18" attr="2097159"
        property="PASSWORDCONFIRMATION"
        text="[PASSWORD]"
        nextcontrol="Back" />

        <!-- Default footer (similar on all dialogs) -->
    <control dialog="UserCredentialDlg" name="BottomLine" type="Line"
        x="0" y="234" width="374" height="0" attr="1" />
    <control dialog="UserCredentialDlg" name="Back" type="PushButton"
        x="180" y="243" width="56" height="17" attr="3"
        text="[ButtonText_Back]" nextcontrol="Next" />
    <control dialog="UserCredentialDlg" name="Next" type="PushButton"
        x="236" y="243" width="56" height="17" attr="3"
        text="[ButtonText_Next]" nextcontrol="Cancel" />
    <control dialog="UserCredentialDlg" name="Cancel" type="PushButton"
        x="304" y="243" width="56" height="17" attr="3"
        text="[ButtonText_Cancel]" nextcontrol="BannerBitmap" />

</controls>

This code block defines the controls that go on the dialog.  The
nextcontrol attribute specifies which control (on that dialog) gets
focus next, when the user presses tab.  There must be a closed circle.
 I changed some of your initial code so that the cycle is closed.

You can add a control condition element block to conditionally
show/hide controls on the dialog.  This block is useful if you would
like to disable the next button until the user has entered a username.
 For that, you can do something like the following:
<controlconditions>
    <controlcondition dialog="UserCredentialDlg" control="Next" action="Disable"
        condition="USERNAME=&quot;&quot;" />
    <controlcondition dialog="UserCredentialDlg" control="Next" action="Enable"
        condition="USERNAME&lt;&gt;&quot;&quot;" />
</controlconditions>

To control what happens when a user clicks a button on your dialog,
you need to add events to the controls.  This is done via the control
events element.  Because you're adding a dialog, you'll need to remove
existing control events and add new ones pointing to the correct
dialog.  To add your dialog between the user registration dialog and
the setup type dialog, you would add the following block:

<controlevents>
    <!-- Remove the old control events -->
    <controlevent dialog="UserRegistrationDlg" control="Next" name="NewDialog"
        argument="SetupTypeDlg" condition="ProductID" remove="true" />

    <controlevent dialog="SetupTypeDlg" control="Back" name="NewDialog"
        argument="LicenseAgreementDlg"
condition="ShowUserRegistrationDlg &lt;&gt; 1" remove="true" />
    <controlevent dialog="SetupTypeDlg" control="Back" name="NewDialog"
        argument="UserRegistrationDlg"
condition="ShowUserRegistrationDlg = 1" remove="true" />

    <!-- Replace the old events (just deleted) with new ones mapping
to the new dialog -->
    <controlevent dialog="UserRegistrationDlg" control="Next" name="NewDialog"
        argument="UserCredentialDlg" condition="ProductID" />
    <controlevent dialog="SetupTypeDlg" control="Back" name="NewDialog"
        argument="UserCredentialDlg" />

    <!-- Add new control events for the new dialog -->
    <controlevent dialog="UserCredentialDlg" control="Cancel" name="SpawnDialog"
        argument="CancelDlg" order="0" />
    <controlevent dialog="UserCredentialDlg" control="Back" name="NewDialog"
        argument="LicenseAgreementDlg"
condition="ShowUserRegistrationDlg&lt;&gt;1"
        order="0" />
    <controlevent dialog="UserCredentialDlg" control="Back" name="NewDialog"
        argument="UserRegistrationDlg" condition="ShowUserRegistrationDlg=1"
        order="0" />

    <controlevent dialog="UserCredentialDlg" control="Next" name="NewDialog"
        argument="SetupTypeDlg" condition="1" order="0" />
</controlevents>


Let me know if things are still a little foggy... I've included the
test file that I used to add this dialog.

Jim

Attachment: default.build
Description: Binary data

Reply via email to