Adding a custom dialog
The following article uses options that are available starting with the Enterprise edition and project type.
The tutorial will guide you step by step in creating a new installer dialog using the Advanced Installer Dialog Editor.
1. Create project
Let's suppose that you want to create a package for a client type application. In order to properly configure the client you will need to obtain from the user additional information like server address, port number, firewall settings etc. and store it in the registry.
The information will be retrieved with the use of a custom dialog.
Create an Enterprise project.
Add the necessary files to the package. In order to simulate the client application any EXE file will do. You can use the one provided in the Sample Application from the Professional Installation tutorial.
2. Add a new dialog to the project
After adding the files to the package it is time to create the custom dialog.
Switch to the Dialogs page.
The dialog should be displayed during a normal installation so we will add it in the "First Time Install" section of the "Install Sequence" tree, under the FolderDlg dialog (this dialog prompts the user to specify an install location).
Select "FolderDlg" in the tree and use thecontext menu item. A new dialog will appear in the "First Time Install" tree. It will also be displayed in the middle pane.
3. Customize dialog appearance
Select the dialog and in the Properties pane from the right, make the following modifications:
Dialog Name = SettingsDlg
You will notice that the name of the dialog will be updated in the tree.
Now it is time to change the default texts from the dialog. Using the Properties list change "New Dialog" to "Settings Dialog" and "New Dialog Description..." to "Application Settings"
Build and run the package. In the install wizard the dialog will appear like:
4. Add controls to the dialog.
In order to retrieve the server address and port number, we will use two edit box and two static text controls inside a group box. Also, we will add a checkbox control for the firewall settings.
Use the controls to the dialog.toolbar button to display the toolbox and add the
5. Associate properties with controls
After retrieving the information from the controls we will use properties to store it. Some of the controls have associated properties. We will edit the name of those properties so they will reflect the purpose of the control.
Select the first edit box from the dialog. The Properties list will be updated with the control's properties. Edit the “Property Name” field to SERVER_ADRESS.
Do the same for the second edit field and set its associated property to PORT_NUMBER.
These two properties will contain the text entered by the user in the edit fields.
In the case of the checkbox control in addition to the property name you will have to specify the following attributes:
- Selected - Specifies if the checkbox is checked by default or not.
- Value - The value of the property after the checkbox is ticked.
The fields will be:
Property Name = FIREWALL_SETTINGS Value = Yes Default Value = <blank>
It you specify a default value for a checkbox property, by default the checkbox will appear ticked so we will leave the “Default Value” field blank.
Build and run the project
6. Add registry entries
As said before the gathered information will be stored in the Registry. Create the necessary registry entries to store the value of the SERVER_ADRESS, PORT_NUMBER and FIREWALL_SETTINGS properties as described in the Professional Installation tutorial.
Build and run the project. Check out the registry, you will find the specified information stored.