MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: ComPlusExport[Next]: /Dialog
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Dialog

The "Dialog" Command

This command defines the start of a dialog which is based on a "uisample.msi" template so that it fits in with the rest of the UI wizard's look and feel.

After this command and before the required "/Dialog" command (which is actually what creates the dialog) you should place zero or more "DialogEntry" commands.

Note that the dialog is built following the "uisample.msi" template but is then converted like any other dialog by "UISAMPLE.MMH" so its look and feel will match your wishes.

I would like to do more with validation, any other tips from people more experienced with dialogs appreciated.

This command takes these parameters:

You may also wish to have a look at the "Twin Dialogs" section for a workaround to a refresh issue.

The "Read Me Dialogs" tip shows you how to create an empty dialog and add some controls that MAKEMSI doesn't support.

Windows Installer - Dialog Related Tables

More complex behaviours such as the enabling or disabling of controls can be performed (although Windows Installer has major limitations in this area - some controls work better than others), suck it and see. Be sure to check out the available "Control Events" and the main dialog tables tables you would be interested in are:

Example of how it might look

The following picture has my configured "look and feel" (titlebar's contents, graphic bar on top, the icon in it and the bottom line etc). The Dialog ID is in the titlebar by choice as I built the dialog in "development mode".

It may also not exactly match the sample code as I may not keep this picture in exact sync with the code (either due to lack of time or bad memory).

Dialog Flow & Conditional Dialogs

MAKEMSI only supports unconditional insertion of the dialog, you may wish to only display the new dialog under certain conditions and you may wish to show one of many possible dialogs. This is an attempt to show the simple flow that MAKEMSI supports (and the 2 or 4 locations modified):

+--[ Previous Dialog ]--+        +--[ Our NEW Dialog ]--+        +--[ Next Dialog ]--+
|                       |<<<<<<<<< Back                 |<<<<<<<<< Back              |
|                  Next >>>>>>>>>|                 Next >>>>>>>>>|                   |
+-----------------------+        +----------------------+        +-------------------+

Where you didn't begin the "INSERT" parameter's value with a "!" (that is the dialog's display is unconditional) MAKEMSI uses this code to perform the insertion (defined in a macro you can override if you wish):

#(
    ;--- Define inserion logic (allow user to replace) ----------------------
    #define? DIALOGTEMPLATE_DialogInsertLogic

    ;--- This code modifies the "Previous" and "Next" dialogs buttons -------
    ;
    ;    +--[ Previous Dialog ]--+        +--[ Our NEW Dialog ]--+        +--[ Next Dialog ]--+
    ;    |                       |        |                      |<<<<<<<<< Back              |
    ;    |                  Next >>>>>>>>>|                      |        |                   |
    ;    +-----------------------+        +----------------------+        +-------------------+

    ;--- Validate parameters -----------------------------------------------
    {$!:RxVarPrev,RxVarThis,RxVarNext}

    <$Table "ControlEvent">
       ;--- Correct Next Link (on previous dialog) --------------------------
       #(
           <$Row
                  @Where=^Dialog_ = '<??{$RxVarPrev}>' AND Control_ = 'Next' AND Event = 'NewDialog'^
                     @OK=^? >= 1^
                Argument="<??{$RxVarThis}>"
           >
       #)

       ;--- Correct "Back Link (on next dialog) -----------------------------
       #(
           <$Row
                  @Where=^Dialog_ = '<??{$RxVarNext}>' AND Control_ = 'Back' AND Event = 'NewDialog'^
                     @OK=^? >= 1^
                Argument="<??{$RxVarThis}>"
           >
       #)
    <$/Table>
#)

If you used "!" in the "INSERT" parameter then you would also use very similar commands to set up the "Next" and "Back" buttons, the main difference being that you would probably not only be adding extra entries but would also specify appropriate conditions for the "Condition" column of the "ControlEvent" table.

It may also be that you need to add to (or override) the entries MAKEMSI created for the "Back" and "Next" buttons of this dialog.

For an example of conditional dialog flow have a look at the see the "TryMeConditionDialogs.MM" sample.

Example 1

;--- Insert after which dialog? (I never have a "UserRegistrationDlg") ------
#ifdef REMOVED_LicenseAgreementDlg          ;;Only exists if the dialog has been removed...
       #define InsertAfter WelcomeDlg
#else
       #define InsertAfter LicenseAgreementDlg
#endif

;--- Actually create the dialog and insert into the UI ----------------------
<$Dialog "Test Dialog #1" INSERT="<$InsertAfter>" Dialog="MyFirstSettingsDialog">
    ;--- Two entry fields with tooltips (one a password field) --------------
    <$DialogEntry Property="ANSWER1" Label="&Name:"     ToolTip="Enter the users name (max 10 characters)"     Max=10 Width=200>
    <$DialogEntry Property="ANSWER2" Label="&Password:" ToolTip="Enter the users password (max 20 characters)" Max=20 Password=Y>
    <$PropertyList "MsiHiddenProperties" Value="ANSWER2">   ;;Should not be logged...

    ;--- Try a "MaskedEdit" type entry field --------------------------------
    <$DialogEntry Property="ANSWER3" Label="IP &Address:" Control=^ME:###.###.###.###^ ToolTip="IP address (4 bytes 0-255)">

    ;--- Try an entry field which is validated via a regular expression -----
    <$DialogEntry Property="ANSWER4" Label=^&Start with "ABC":^ BLANK="Y" MatchRe="^ABC.+$" CASE="?" ToolTip=^Min 4 characters starting with "ABC" (any case)!^>

    ;--- Entry field for an integer in the range 80-90 ----------------------
    <$DialogEntry Property="ANSWER5" Label="Want &Integer 80-90:" Max="2" Width=35 Integer="80 to 90">

    ;--- Add a combo box (user can choose existing or enter their own) ------
    #data 'ComboBox_ANSWER6' 2
        ;--- Define sounds and a test description shown in the pull down ----
        "woof woof"     "Dog"
        "quack quack"   "Duck"
        "bah bah"       "sheep"
        "moo moo"       "cow"
        "meeow meeow"   "cat"
    #data                       ;;Note that we dynamically add a couple of entries in the custom action below
   <$DialogEntry Property="ANSWER6" Label="Choose a sound:" Control="CB">

   ;--- Check Box -----------------------------------------------------------
   <$DialogEntry Property="ANSWER7" Label="Want more Money?:" Control="XB:False|True" ToolTip="A silly question...">

   ;--- A Radio Button ------------------------------------------------------
   #data 'RadioButton_ANSWER8'
         ;--- All buttons on same dialog line (not over 3) ------------------
         'Yes'   'I accept'               '50'  'Got heaps of money have you?'
         'No'    'No way in a fit!'       '75'  'Smart decision...'
         'Maybe' "Maybe, Oh I don't know" '130' 'Oh well not everyone has brains'
   #data
   <$DialogEntry Property="ANSWER8" Label="Buy car for $1,000,000:" Control="RB">
<$/Dialog>


;--- A second dialog --------------------------------------------------------
#define? TRYME_INCLUDES_LISTVIEW        Y       ;;Y/N - Only room for ONE ListBox or ListView!
<$Dialog "Test Dialog #2" INSERT="MyFirstSettingsDialog">
    ;--- A text only line ---------------------------------------------------
    <$DialogEntry Label="Want to remove Existing files?" Control="Text" LabelWidth="300">

    ;--- The radio button ---------------------------------------------------
    #data 'RadioButton_REMOVE_FILES'
           'Yes'   'Yes'  ''    ^Please note that your Data can't be recovered!^
           'No'    'No'   ''    ''
    #data
    <$DialogEntry Property="REMOVE_FILES" Label="" Control="RB" LabelWidth="0">

    ;--- Which control? -----------------------------------------------------
    #if ['<$TRYME_INCLUDES_LISTVIEW $$UPPER>' = 'N']
        ;--- A ListBox ----------------------------------------------------------
        #data 'ListBox_LIST_VALUE' 2
            ;--- Define sounds and a test description shown in the pull down ----
            "One"   "Choose Me #1"
            "Two"   "Choose Me #2"
            "Three" "Choose Me #3"
            "Four"  "Choose Me #4"
            "Five"  "Choose Me #5"
            "Six"   "Choose Me #6"
            "Seven" "Choose Me #7"
            "Eight" "Choose Me #8"
            "Nine"  "Choose Me #9"
        #data
        <$DialogEntry Label="Choose a listbox value:" Control="TEXT">                                     ;;Want label on its own line
        <$DialogEntry Property="LIST_VALUE" Control="LB" LabelWidth="0" Label="Choose a listbox value:">  ;;Re-specify label ONLY for any failed validation message (don't display it here)
    #else
        ;--- A ListView ---------------------------------------------------------
        <$Binary Key="SomeGraphic.ico" "TryMe.ICO">     ;;Obviously in a real application you'd use more than one graphic!
        #data 'ListView_LIST_VALUE' 3
            ;--- Define sounds and a test description shown in the pull down ----
            "One"   "Choose Me #1"     "SomeGraphic.ico"
            "Two"   "Choose Me #2"     "SomeGraphic.ico"
            "Three" "Choose Me #3"     "SomeGraphic.ico"
            "Four"  "Choose Me #4"     "SomeGraphic.ico"
            "Five"  "Choose Me #5"     "SomeGraphic.ico"
            "Six"   "Choose Me #6"     "SomeGraphic.ico"
            "Seven" "Choose Me #7"     "SomeGraphic.ico"
            "Eight" "Choose Me #8"     "SomeGraphic.ico"
            "Nine"  "Choose Me #9"     "SomeGraphic.ico"
        #data
        <$DialogEntry Label="Choose a listview value:" Control="TEXT">                                                 ;;Want label on its own line
        <$DialogEntry Property="LIST_VALUE" Control="LV" Width="120" LabelWidth="0" Label="Choose a listview value:">  ;;Re-specify label ONLY for any failed validation message (don't display it here)
    #endif
<$/Dialog>

See the "TryMeWithUserDialog.MM" sample to see a complete example with realistic supporting code.

Example 2

;--- Example of multiple (two) dialogs --------------------------------------
<$Dialog "Q1 Dialog1" INSERT="WelcomeDlg" Dialog="Dialog1">
    <$DialogEntry Property="ANSWER1" Label="&QUESTION 1:">
<$/Dialog>
<$Dialog "Q2+ Dialog2" INSERT="Dialog1">
    <$DialogEntry Property="ANSWER2" Label="&QUESTION 2:">
    <$DialogEntry Property="ANSWER3" Label="Want more Money?:" Control="XB:False|True" ToolTip="A silly question..." SameLine=Y LabelWidth=80>
<$/Dialog>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: ComPlusExport[Next]: /Dialog


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday August 13 2017 at 2:39pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.