Trouble with Cancel/Finish Buttons Visible/Enabled Propertie

Wizard for Windows Forms Forum

Posted 19 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
I recently tried to create a Wizard page that only had a 'Finish' button. The following code was placed in the 'OnSelectionChanged' override for the Wizard:

this.Wizard.BackButtonEnabled = false;
this.Wizard.NextButtonEnabled = false;
this.Wizard.FinishButtonEnabled = true;
this.Wizard.CancelButtonEnabled = false;
this.Wizard.SelectedPage.BackButtonVisible = false;
this.Wizard.SelectedPage.NextButtonVisible = false;
this.Wizard.SelectedPage.FinishButtonVisible = true;
this.Wizard.SelectedPage.CancelButtonVisible = false;

This code resulted in only the 'Finish' button being displayed, but the button was not enabled. I then modified the above code so that the cancel button would be visible (but not enabled):

this.Wizard.BackButtonEnabled = false;
this.Wizard.NextButtonEnabled = false;
this.Wizard.FinishButtonEnabled = true;
this.Wizard.CancelButtonEnabled = false;
this.Wizard.SelectedPage.BackButtonVisible = false;
this.Wizard.SelectedPage.NextButtonVisible = false;
this.Wizard.SelectedPage.FinishButtonVisible = true;
this.Wizard.SelectedPage.CancelButtonVisible = true;

This code resulted in both the 'Finish' button and the 'Cancel' button being displayed. The 'Finish' button was still disabled, but the 'Cancel' button was now enabled (opposite of what was expected). I then modified the code so that both the cancel button and finish button should be visible and enabled:

this.Wizard.BackButtonEnabled = false;
this.Wizard.NextButtonEnabled = false;
this.Wizard.FinishButtonEnabled = true;
this.Wizard.CancelButtonEnabled = true;
this.Wizard.SelectedPage.BackButtonVisible = false;
this.Wizard.SelectedPage.NextButtonVisible = false;
this.Wizard.SelectedPage.FinishButtonVisible = true;
this.Wizard.SelectedPage.CancelButtonVisible = true;

The result didn't change. Both buttons visible, only 'Cancel' button was enabled.

I've actually changed my approach to just use a single 'Cancel' button (this is probably what I should have done anyway), but I thought I'd still bring this to your attention.

Comments (2)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Boyd,

The WizardPage.XXXButtonVisible properties have code in them that sets the default button enabled states again. If you change the order so that the XXXButtonVisible calls are before the XXXButtonEnabled calls, it works fine.


Actipro Software Support

Posted 19 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
Thanks for the inside tip.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.