Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

Using check boxes instead of CustomizeDlg

I would like to replace the CustomizeDlg with a custom dialog that has a check box for each feature. There is a simple example of how to do this in the Advanced Installer Help > Tutorials... > How To's, Q&A > How do I show a custom selection dialog? But this only tells half the story.

All the features are optional. I want the Next button to be disabled if none of the features are selected and I want a description panel similar to the one on the CustomizeDlg. I think I can work this out, but if anyone has any experience with this sort of thing, I'd be interested to hear of any traps or pitfalls to be careful of. I was thinking of using JavaScript, but VBscript would be okay. What are the pros and cons of each?

In addition, I want the installed features to initially be shown as selected when doing a change during the maintenance UI sequence. How do I persist the state of the properties for the check boxes? Do I have to keep track of them in the registry or what? If so, how do I read them from the registry?

Any help before I start on this would be greatly appreciated.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Using check boxes instead of CustomizeDlg

Hi,
I want the Next button to be disabled if none of the features are selected
This can be done by using control conditions for the "Next" button on your custom dialog dialog. The control conditions can look like this:

Code: Select all

(CHECK1 OR CHECK2 OR CHECK3)                         Enable
(NOT CHECK1) AND (NOT CHECK2) AND (NOT CHECK3)       Disable
where CHECK1, CHECK2 and CHECK3 are the properties in the sample project from the how-to.
I want a description panel similar to the one on the CustomizeDlg.
I'm afraid that this is not supported by Windows Installer because the text shown in the "CustomizeDlg" dialog subscribes to the selected feature in the Selection Tree. Also, since you are using checkboxes I doubt there is way of modifying a text control (a checkbox can be checked or unchecked, it cannot be selected).
I was thinking of using JavaScript, but VBscript would be okay. What are the pros and cons of each?
If you can find a solution for what you want, it is better to implement it in VBScript. This is because VBScript is more compatible with Windows Installer compared to JScript (JScript has some limitations).
I want the installed features to initially be shown as selected when doing a change during the maintenance UI sequence.
This can be done by setting the properties of the checkboxes to a value before the dialog is shown. For example, you can use SetProperty Init Events for the custom dialog. Since you need to check only the checkboxes for the installed features, you can condition the Init Events with the feature state of each feature.

For example, if you have a feature with the identifier "MyFeature" and it's associated with a checkbox that has the property MY_FEATURE, the Init Event would look like this:

Code: Select all

[MY_FEATURE]       myvalue       !MyFeature=3
This means that the MY_FEATURE property will be set to "myvalue" only if the feature with the identifier "MyFeature" is installed.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

Re: Using check boxes instead of CustomizeDlg

I can add the FeatureSelectionDlg to the First Time Install sequence, select and deselect features and disable the Next button if nothing is selected. So far, so good.

I can add the FeatureSelectionDlg to the Maintenance sequence, but it refuses to be put in the right place. It can only be placed between MaintenanceWelcomeDlg and MaintenanceTypeDlg. This is wrong. It needs to be placed as a child of MaintenanceTypeDlg in place of CustomizeDlg, but it can't be moved and the CustomizeDlg can't be deleted. When the maintenance sequence is run, you get the FeatureSelectionDlg followed by the out-of-sequence MaintenanceTypeDlg. Click Change and do not change anything in the unwanted CustomizeDlg and everything is removed, contrary to the selections in both the FeatureSelectionDlg and CustomizeDlg. Damn.

(Correction: I had changed the drive during initial installation. Old features were deleted from D: and new features were incorrectly added to C:. Same issue as reported in another thread.)

I was surprised to find that there is no selection event for check boxes (or focus gained or focus lost events). This is apparently a Windows Installer shortcoming, so I'll have to live with it. Pity, as I had other things in mind for dynamically updating help text as the state changed.

Can anyone recommend a good guide to VBScript as applied to Windows Installer scripts?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Using check boxes instead of CustomizeDlg

Hi,
It needs to be placed as a child of MaintenanceTypeDlg in place of CustomizeDlg,
This can be done by using "NewDialog" control events for the "Back" and "Next" buttons of the maintenance dialogs. You can find a similar approach in the Add a dialog after "SetupTypeDlg" how-to.
Can anyone recommend a good guide to VBScript as applied to Windows Installer scripts?
We use the articles in the MSDN, perhaps you will find them useful.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
finkbr
Posts: 9
Joined: Fri Jul 11, 2008 5:59 pm

Re: Using check boxes instead of CustomizeDlg

Please see my other post on this topic.

Return to “Common Problems”