How To: Control Feature Installation Using a CheckBox |
|
|
|
How To: Control Feature Installation Using a CheckBox |
|
|
|
|
||
MSI Factory
There may be times that you want to control whether or not a feature is installed using a checkbox control on a dialog. To do this, you will need to do the following:
This step defines a public property that will be used to control the conditional level of the feature as well as in the checkbox on the user interface dialog.
- Select Project > Settings from the menu and then go to the Properties tab.
- Click the Add button to add a new property.
- Call the property something like "INSTALL_FEATURE" (no quotes).
- Set the value to "1" (no quotes).
- Check the "Allow transfer to server side" checkbox.
- Click OK to create the property.
This step sets the conditional level of the feature to 0 (do not install) if the property created in step 1 above is not defined or 1 (install) if the property is defined. Note that this works in this case because of the nature of a checkbox control which sets the property if checked and "un-defines" (sets to null) the property if unchecked.
- Open the Features screen (Project > Features).
- Double-click on the feature that you want to conditionally install.
- Press the Conditional Levels button to open the Conditional Levels dialog.
- Add a Condition Level with Level set to "0" (no quotes) and the condition set to "Not INSTALL_FEATURE" (no quotes).
- Add another Condition Level with Level set to "1" (no quotes) and the condition set to "INSTALL_FEATURE" (no quotes).
- Click OK to accept the changes.
- Either on a new or existing dialog, add a checkbox control. You can access your dialogs from Project > Dialogs on the menu.
- Double-click the newly-created checkbox control to open the CheckBox Properties dialog.
- Enter text in the Text field such as "Install <feature name>" (where <feature name> is a description of your feature.)
- In the "Property name" field, enter the name of the property specified in step 1 above.
- Set "Value when checked" to "1" (no quotes).
- Check the "Integer" checkbox below the "Property name" field.
- Click OK to accept the changes.
Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us