Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Enabling a Button


9 replies to this topic

Madhu

Madhu
  • Members
  • 13 posts

Posted 22 February 2001 - 15:04

On one of the dialog Boxes I have an Edit Box and it is a mandatory field.  User has to enter something before proceeding.  When I initially display this dialog, the Next button is disabled.  When a user starts to enter in the Edit Box, The Next Button should be enabled.  I am unable to schieve this.   I tried to add condition associated with the Next Button  -
Action           Condition
Disable       Field = ""
Enable         Field <> ""

By doing so, the Next Button is Disabled initially  but is not getting enabled even after typing a value in the EditBox.  I guess it is looking for an event and typing is not an event.  Any suggestions how to achieve this?


SteveP

SteveP
  • Members
  • 126 posts

Posted 22 February 2001 - 18:39

Rather than disabling your Next button, you may want to add a condition to the ControlEvent associated with the Next button that does not allow the dialog to be closed if the edit control is blank.  You could sequence two control events from the pushbutton ... the first to display a popup message box explaining that the edit field is not optional that will fire if the edit field is blank and the second to proceed to the next sequence dialog if the edit field is populated.

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 22 February 2001 - 23:29

Madhu,

What you are proposing does work, but there are two points to take note of.  The condition column should be of the form Property = Value.  Secondly, with an edit box, I dont the property is set until the focus is lost from the control.  Therefore, the button will not become enabled until the user has moved away from the edit box.

Hope this helps,

Leigh.


SteveP

SteveP
  • Members
  • 126 posts

Posted 23 February 2001 - 16:04

I don't know what the precise timing is, but using the conditional on the Next button of the dialog does work as recommended.  In my test case, I used the conditional PWD <> "" (note the use of the Property, not the value of the property) and the dialog does not allow the user to leave the form until something is in the edit box.

Generous

Generous
  • Members
  • 53 posts

Posted 23 February 2001 - 17:32

I try add conditions to Next button on standard User Information dialog:
disable  USERNAME = ""
enble  USERNAME <> ""
The Next button is changed own state only if I moved to another control, but  its work.

IMHO bad if user understand why Next button will be disabled. You need show message box if user input invalid data to dialog.

SteveP say good tip.


mbeale

mbeale
  • Members
  • 1 posts

Posted 04 April 2001 - 05:44

This still allows for blank entries (try spaces).  Is there a better way?  (Jscript?)

SteveP

SteveP
  • Members
  • 126 posts

Posted 11 April 2001 - 21:19

Another way to handle the enabling and disabling of controls is to add a record to the ControlCondition Table.  Identify the dialog and control, set the action (Default - set as default control, Enable, Disable, Hide, Show), and then enter a conditional that describes how you want the control to behave.

You can easily eliminate blank entries in the conditional statement.  Spaces are legitimate characters, so they will satisfy simple conditionals.  For more complex testing, I suspect you would need to launch a custom action for field validation.

Please note that Leigh's comment applies here, too.  The conditional is not evaluated until the edit control loses the focus, so  you will need to have another control to accept the focus in order to get the 'disabled' control to be 'enabled'.


Zachmc

Zachmc
  • Members
  • 6 posts

Posted 02 August 2001 - 23:49

Can anyone suggest a way to have a custom action that makes the control ('Next' in this case) changed to Enabled as soon as any character is entered in the field (without leaving the Edit field hence without losing focus)?

Thanks!


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 03 August 2001 - 08:19

Entering a character in an edit field does not send any notification messages, so there's nothing you can do. The first time the edit box sends a message is when it loses focus. So what you want is not possible with Windows Installer dialogs.

You could however create a dialog in a DLL and process the messages in C, and call this dialog in a custom action. You could even write the dialog section in InstallScript which gives you more control over the dialog behaviour. (BTW that's how InstallShield Developer 7 works by default)