dahall / AeroWizard

Library for easy creation of custom and Aero Wizards. Aero Wizard strictly follows Microsoft guidelines and uses Visual Styles to get visual theming.
MIT License
113 stars 32 forks source link

Cancel Button not working when validation on controls is implemented #3

Closed swinks closed 6 years ago

swinks commented 6 years ago

Hello, firs of all: Thanks for providing this useful tool.

I'm facing the problem that the cancel-button is not working when I implement validation on a textbox for example. When validation fails, next-button doesn't work. Works as designed. But the cancel-Button also is not working. I've tried to set causeValidation to false at all controls (wizard control, commandArea, commandAreaButtonFlowLayout and cancelButton) but I didn't manage to make it possible to cancel the wizard when validation of field contents fails. Do you have any advice? Thanks in advance, Stefan

dahall commented 6 years ago

You're welcome. And thank you for your gratitude. It is nice to hear my work has had value for someone.

On your problem, this library really does absolutely nothing with form validation so the effects you are seeing come from the form. When a WizardControl is added to a form, it assigns its Cancel button to the form's CancelButton property and the Next button to the form's AcceptButton property. Validation works with those values. You could unassign the CancelButton property for your form. The WizardControl does that assignment on Form.Load events and on the system events ColorizationColorChanged, CompositionChanged, DisplaySettingsChanged and DisplyColorOrCompositionChanged.

swinks commented 6 years ago

Wow, I didn't expect such a quick response. Thank you. I didn't follow your advice exactly but it led me to a - from my point of view - more simple idea. I just catch the cancelling event from the WizardControl and get the stuff I need done there. That does the trick for me.

Thank you for your support. Kind regards from Germany ;-) Stefan