ComboBox change event enable/disable next - Advanced Installer Community
anup
Posts: 8
Joined: Thu Apr 01, 2010 10:20 pm

ComboBox change event enable/disable next

Have a dialog having a combobox (list of values) and a Next button. I need to enable/disable the Next button depending on the choice selected in the combobox. I read about the control conditions but was not sure how to tie that to the combobox value.

How can this be achieved? Need guidance on how to go about it. Thx.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: ComboBox change event enable/disable next

Hello,
How can this be achieved? Need guidance on how to go about it. Thx.
The combobox control property name from the right pane( Properties ) holds the selected value of the combo box control.

You can add this property as part of your "Next" button's control conditions on enable/disable actions. Something like:

Condition:COMBOBOX_1_PROP = "1"
Action:Disable

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anup
Posts: 8
Joined: Thu Apr 01, 2010 10:20 pm

Re: ComboBox change event enable/disable next

The combobox loads data dynamically based on a VBScript Custom Action.

Am still not getting how to change the condition to include like a DoAction. On the "Control Conditions" tab when I click "New" see a window that allows to set a condition and what action to take on that condition. The action can be Default, Enable, Disable, Hide, Show.

One logic I am thinking may work but am not sure how to implement. Somehow trap the Change Item event of the drop-down. In that I set a property/variable. In the Next button Control Conditions I enter condition myvariable = "1" then Enable and myvariable = "0" then Disable. Question remains how to trap the change item event of the drop-down and run like a DoAction VBScript behind it.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: ComboBox change event enable/disable next

Hello,

It doesn't matter how the combo box gets populated in order for the "Next" button to get disabled or enabled depending on the selected value.

Here's a sample project that demonstrates the "Next" button's control conditions:
DisableEnableButton_from_ComboBox.aip
(13.05 KiB) Downloaded 645 times
The functionality is implemented in the "NewDialog" from the First Time Install tree in the Dialogs Page.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anup
Posts: 8
Joined: Thu Apr 01, 2010 10:20 pm

Re: ComboBox change event enable/disable next

Thanks for the example. It assumes the code knows what are the values in the drop-down. Mine is dynamically loaded hence cannot predefine the control conditions for enable/disable.

Is it possible to do something like

CheckCombo() = True in the control action. Where CheckCombo is a custom action
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: ComboBox change event enable/disable next

Hello,

If you do not know the values that are going to be dynamically loaded in the ComboBox control, you can have public properties set from the custom action in the "Next" button's control conditions before the dialog is displayed.

In VBScript, installer public properties can be accessed like this:

Code: Select all

' read
value = Session.Property("PROPERTY_NAME")

' write
Session.Property("PROPERTY_NAME") = value
In a C++ DLL you can use the MsiGetProperty and MsiSetProperty functions.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kondriks
Posts: 36
Joined: Mon Nov 17, 2014 3:49 pm

Re: ComboBox change event enable/disable next

I need to disable the Next button when the data in combo box not selected. How to implement it?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: ComboBox change event enable/disable next

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to do this you can use our "Dialog Editor" feature available starting with an "Enterprise" edition of Advanced installer. Here are the steps to proceed:
1. go to "Dialogs" page and select the [Next>] button
2. add on it two control conditions like this:
  • Condition: COMBOBOX_1_PROP = ""
    Action: Disable

    Condition: COMBOBOX_1_PROP
    Action: Enable
3. build and test the project

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”