shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

How to enable/disable NEXT button on textbox keypress event?

Hi,

I have a dialog which has two edit boxes. One for username(PROP_USERNAME) and the other for the password(PROP_USERNAME). I would need "Next" button to be disabled until the user types something in the username edit box.

I tried http://www.advancedinstaller.com/forums ... =2&t=20788 which says I would need following two "Control Conditions" for the "Next" button

Code: Select all

Enable  PROP_USERNAME 
Disable NOT PROP_USERNAME
However, the above does not work for the keypress event, it works only when I move out of username editbox(e.g. When I type something in the username, "Next" button does not get enabled. It gets enabled when the focus is moved out of the username editbox)

Is this possible to enable the "Next" as soon as user types something in the username editbox?

Regards,
Rohan
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to enable/disable NEXT button on textbox keypress ev

Hi Rohan and welcome to Advanced Installer.

Thank you for your interest in Advanced Installer.

Most likely you use a standard MSI package whose normal behavior is to set an edit box property only when the focus in moved out. It does not update the property every time you write a letter in the edit box.

In order to achieve what you want you can enable the Enhanced User Interface which is an Advanced Installer 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.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

Thank you for your quick response. I do appreciate your help.

I have tried the solution http://www.advancedinstaller.com/user-g ... field.html which seems to be kind of good work around.
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

I have one more related question.
Suppose the user tries to press "Next" without entering any value in the password editbox, then "Are you sure you want to go ahead with empty password?" confirmation message box[MBYESNo] should appear.
If the user clicks on "No", then password editbox should get focus.
If the user clicks on "YES", then the control should go to next screen.

Any help is appreciated.
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

Hi,

In order to achieve this you must create a "Display message box" custom action without sequence. (I'm sure the How do I display a message box? article will help you).

In the "Action Data" text field you must paste the following code:

Code: Select all

"Are you sure you want to go ahead with empty password? | Title | MB_YESNO , MB_SETFOREGROUND , MB_ICONQUESTION | MYRESULTPROPERTY | [CLIENTPROCESSID]"
Then, go in the dialog that contains the username and the password and click on the "Next" button.
In the Published Events tab you have a "Display a specific dialog" event created by default, click on the edit button and set its condition:

Code: Select all

(MYRESULTPROPERTY = "IDYES") OR (PROP_PASSWORD)
Create another event "Execute custom action", select the custom action you created as an argument and set the condition:

Code: Select all

NOT (PROP_PASSWORD)
Be sure the "Execute custom action" event is listed above the "Display a specific dialog" event.

Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

Thank you Bogdan :), Its working as expected. I appreciate your help.
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

After the messagebox, is it possible to set the focus on the password edit box?
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to enable/disable NEXT button on textbox keypress ev

Hi Rohan,

Unfortunately we don't have support for this.

You can achieve this only by creating your own custom action which has the functionality of displaying a message box and also focusing the edit box you want when you click a button.

Please keep in mind that you will no longer need the "Display message box" custom action because the one you created implements also its functionality.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shetty_rohan
Posts: 363
Joined: Fri Dec 07, 2012 5:28 am
Location: Bangalore, India
Contact: Website

Re: How to enable/disable NEXT button on textbox keypress ev

Thanks for your response.Though I am little disappointed, I guess this limitation is because of the Midrost windows installer.

Return to “Building Installers”