Creating Custom Dialog Enabling Mutually Exclusive Features

Creating Custom Dialog Enabling Mutually Exclusive Features


How to create a custom dialog with a mutually exclusive feature


This article provides a quick highlight on SelectionTree control, and its limitations in the scope of MSI, and describes an alternative method to enable mutually exclusive features.


In a Basic MSI project, SelectionTree control enables users to change the selection state of features in the Feature table. This control is created with the WC_TREEVIEW class with the following styles:

The SelectionTree control will automatically publish the following control events,
  • SelectionAction
  • SelectionBrowse
  • SelectionDescription
  • SelectionNoItems
  • SelectionPath
  • SelectionPathOn
  • SelectionSize
This control does not natively support mutually exclusive selection of features.

Alternative method to enable mutually exclusive feature selection In a situation that only one (1) feature can be selected and installed from a set of given features, the SelectionTree control used in Developer standard dialog is constrained by technology. One alternative is to use a ListBox control to manipulate feature selection.

The steps to create a custom dialog with ListBox control populated with features in the project are as followed.
  • Create an interior dialog
  • Add ListBox control to dialog
  • Populate ListBox control
  • Define feature selection

Step 1: Create an interior dialog as shown below
Figure 1: Blank Interior Dialog
User-added image

Step 2: Add ListBox control to dialog
Figure 2: ListBox control button

User-added image

Figure 3: Custom Feature Selection Dialog?

User-added image

Step 3: Populate ListBox control
Figure 4 shows the complete list of attributes available to ListBox control. We should familiarize ourselves with, at least, the following property names, Property and Items.

Figure 4: ListBox Control Attributes

User-added image

Select and click on property name Items in Figure 4 to bring up dialog (Figure 5).
Figure 5: Add ListBox Item Dialog

User-added image

Click on Add button bring up dialog (Figure 6) to add individual feature into ListBox control. String entered for Value is used internally by MSI, and will not be visible to users at runtime. String entered for Text will be displayed to users. Value and Text do not have to have the same string. If Text is left blank, string entered for Value will be used for Text as well.

Figure 6: Add Items

User-added image

Step 4: Define feature selection Given a set of features as shown in Figure 7, set Install Level of all features to a number higher than the value of INSTALLLEVEL property. The default INSTALLLEVEL is 100. By doing that, it is to initialize all features to be not selected for installation by default.

Figure 7: Existing Features

User-added image

Add AddLocal events to Next button as in Figure 8. It will select a feature for installation based on user?s selection. You can add other necessary events per your installation requirements. AddLocal event takes a string argument, and does not resolve the string. When a list item is selected, the property of ListBox control will contain the string of Value column in Figure 5.

Figure 8: AddLocal Events on Next button

User-added image

Figure 9 shows how the dialog will appear at runtime. To set a default selection, you can assign a value to the property of ListBox control in Property Manager in IDE.

Figure 9: Feature Selection Dialog at Runtime

User-added image

Was this article helpful? Yes No
No ratings

If you're looking for tax saving investments through mutual funds, invest in Axis Long term Equity Fund. This is an ELSS fund which can help you save taxes under section 80C.

Version history
Revision #:
1 of 1
Last update:
‎Jul 02, 2018 10:10 PM
Updated by: