Display a dialog based on a checkbox state
The following article uses options that are available starting with the Enterprise edition and project type.
This tutorial will show how to include a dialog that will be displayed during installation only when a checkbox is ticked.
1. Create project
Let's assume that you want the user to see the release notes of your application only if he desires. To do this you will add a dialog to your project that contains the release notes. The predefined ReadMe dialog should be appropriate for this task. The user selection will be retrieved with the use of a CheckBox control.
Create an Enterprise project and add the necessary files to the package. For more details please see the Professional Installation tutorial.
2. Add a dialog to the project
In this tutorial we will add the predefined ReadmeDlg dialog after the FolderDlg dialog located in the "First Time Install" section of the "Install Sequence" tree.
Go to the Dialogs page.
Select the FolderDlg dialog and use thetoolbar button or the "Add Dialog..." context menu option
In the Add Dialog select the ReadmeDlg dialog
In the "RTF File" field from the Properties pane specify the path to the .RTF file
3. Add the CheckBox which conditions the dialog
Select the FolderDlg item in the tree
Use the Check-box controltoolbar button to add a new
In the Properties pane set the following attributes for this control:
Name=ViewReleaseNotesCheckBox Text=View release notes Property Name=ViewReleaseNotes Value=yes
4. Condition the dialog to appear only when the checkbox is enabled
Select the ReadmeDlg item from the tree and from the context menu select the Show only if... option
The Edit Condition Dialog will appear
In the Expression field write ViewReleaseNotes = "yes"
5. Run the project
The project is now complete, build and run the package.
In this tutorial we have used the property attached to a CheckBox control to configure the condition for an install dialog. However, any predefined Windows Installer or user-defined property could be used to condition a dialog.