kahmad
Posts: 9
Joined: Thu Jun 27, 2013 11:47 pm

How to verify at least one checkbox checked on custom dialog

I have created a custom feature selection dialog using these instructions: http://www.advancedinstaller.com/user-g ... ature.html

This custom dialog contains three checkboxes where each checkbox corresponds to a feature in the project. If the user selects 1+ checkboxes then I would like flow to go to the next dialog (this is the current behavior). If the user selects 0 checkboxes then I would like to display a message to the user and stay on the current dialog (new behavior). How do I go about doing that?

Your help is greatly appreciated!
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to verify at least one checkbox checked on custom di

Hello,

In order to achieve that, you can add some control conditions on the [Next >] button from the dialog where your checkboxes are. You can enable the next button if at least one option is selected otherwise the user cannot proceed further.

For that, you can select the [Next >] button from the regarding dialog. In the “Control Conditions” tab add a new condition using the [New...] button.
For “Disable” action you can use(none of the checkbox options were selected):
NOT (CHECK1 OR CHECK2 OR CHECK3) (where CHECK1 is the property used for the first checkbox and so on)

For “Enable” action you can use(at least one checkbox option is selected):
CHECK1 OR CHECK2 OR CHECK3

So, there is no need to display a message box to inform the user that he must select an option. He cannot go further if he wouldn't select one. You can edit the regarding dialog and type a short message for the user that he must select at least one option in order to proceed further.

If you have any more questions just let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kahmad
Posts: 9
Joined: Thu Jun 27, 2013 11:47 pm

Re: How to verify at least one checkbox checked on custom di

That worked great! Thanks!

I have created another custom dialog that contains an EditBox. Currently, the [Next] button on this custom dialog has the following Control Conditions.

Action: Disable
Condition: EDIT_1 = ""

Action: Enable
Condition: NOT (EDIT_1 = "")

I have 3 questions.

1. When this custom dialog is displayed, how do I get the focus in the EditBox?

2. Currently, the user must type in the EditBox and then tab off the EditBox in order for the [Next] button to be enabled. Is there any way to enable the button as the user is typing in the EditBox?

3. Currently, if the user puts spaces in the EditBox then the [Next] button is enabled. Is there any way to trim the contents of the EditBox? ie, TRIM (EDIT_1) = ""
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to verify at least one checkbox checked on custom di

Hello,
1. When this custom dialog is displayed, how do I get the focus in the EditBox?
In order to achieve that you can use the Control Tab Order Dialog. For that select your related dialog, and use the “Edit” >> “Edit in dialog” toolbar button. Just move your EDIT_1 (the default name for an editBox) to be the first in the “Control Tab Order” list.
2. Currently, the user must type in the EditBox and then tab off the EditBox in order for the [Next] button to be enabled. Is there any way to enable the button as the user is typing in the EditBox?
Unfortunately, this is the default behavior of the Windows Installer. The "Control Conditions" are not evaluated every time you write a character in the related edit box.
However, in order to achieve what you want, you can enable our Enhanced User Interface feature. You can enable it by going in the "Settings" tab from "Theme" page.

Also please keep in mind that your package will be automatically turned into an EXE package.
3. Currently, if the user puts spaces in the EditBox then the [Next] button is enabled. Is there any way to trim the contents of the EditBox? ie, TRIM (EDIT_1) = ""
In order to achieve that you can create, for example your custom action as a custom action written in C# or a custom action written in C++ which can verify if the related EditBox is not containing just white spaces ( char(32) ).

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”