FinishButton Enable & Visible

Wizard for Windows Forms Forum

Posted 10 years ago by TM
Version: 12.1.0304
Platform: .NET 4.5
Environment: Windows 7 (32-bit)
Avatar

I've got a WinForms Wizard version 12.1.304.0 with 3 pages. The last page being wzpComponent, I'd like to simply disable the Finish-button until all required fields in the wizard are completed. This has turned out more difficult than expected. While I thought I could do:

wzpComponent.FinishButtonEnabled = WizardButtonEnabledDefault.False;

It turned out this acts more along the lines of "visible" than "enabled" because the Finish-button disappears and a disabled Next-button shows. Next, I tried this to no avail:

wzpComponent.FinishButtonEnabled = WizardButtonEnabledDefault.False;
wzpComponent.FinishButtonVisible = true;

Really what I want is the Finish-button visible but not enabled until all required fields are done. What I tried after the above was to use:

this.wizard1.FinishButtonEnabled = false;

It didn't disable the Finish-button. It's still enabled. I tried:

this.wizard1.FinishButton.Enabled = false;

Same thing. Still enabled. How do I "disable" the Finish-button and keep it visible? Better yet, databind its enabled/disabled to a true/false-value from my object, which seems a bit difficult with the tristate-enum for FinishButtonEnabled?

Upgrading the Wizard-component is not an option because it's too much work getting approvals.

Best Regards.

Comments (3)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tobias,

If you set Wizard.FinishButtonDistinct set to true, then you can have FinishButtonEnabled = WizardPage.WizardButtonEnabledDefault.False and and WizardPage.NextButtonEnabled = WizardButtonEnabledDefault.False.  That should show both but have them disabled.  Then set the FinishButtonEnabled back to True when your required fields are filled in.

To do the data binding, you would probably need to use ViewModel intermediary property that would convert your bool to our enumeration and have our wizard pages bind to that ViewModel property.


Actipro Software Support

Posted 10 years ago by TM
Avatar

Good morning,

FinishButtonDistinct produces a visible Next-button alongside the Finish-button, which was not what I wanted. I apologize if I was unclear. To rephrase it, when I create a wizard that has 1 interior wizardpage, this bit of code works as expected:

this.wizard1.FinishButtonEnabled = false;

That code will make the FinishButton non-clickable but still visible. Now, for the same wizard, lets say I add 1 more interior page, giving us 2 interior pages, and modifying none of the other code above. This code is all that's in the constructor:

this.wizard1.FinishButtonEnabled = false;

When I click my way to the last page of the 2 interiod pages, the Finish button is there, but it's enabled and clickable. I did not expect that. I thought the code above would make it visible, but not clickable. Should I go to wizardPage2 in the designer and set "FinishButtonEnabled"=false, the button disappears entirely, which I would've expected had the property been named FinishButtonVisible. With the naming conventions in mind, I feel there's got to be some easy way to control this that I'm completely overlooking.

I can not use FinishButtonDistinct because it would cause inconsistent design among the wizards, and result in having to rewrite and republish a lot of educational material.

Best Regards.

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The logic with the properties becomes a bit convoluted when the buttons share the same space, I think because the original design was that the buttons were separate and had properties to support that design.  But then things later changed and we had to make use of the same properties with their existing defaults.

Anyhow, with FinishButtonDistinct = false, you would need FinishButtonEnabled = true to get the Finish button to show.  I think in the Wizard.SelectionChanged event, you could set wizard.FinishButton.Enabled = false to really disable it.  That event fires after we update the button enabled states so that should work.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.