Michael Markieta
Michael Markieta

Reputation: 442

Disable the 'Next' button until condition is met on single page of wx.WizardPageSimple

Using self.GetParent().FindWindowById(wx.ID_FORWARD).Disable() I am able to disable the next button altogether, but I only want my second page in the Wizard to have a disabled button until a condition is met. How can I prevent the next button from being disabled until I reach the second page if all pages are created at once?

Upvotes: 0

Views: 659

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33101

The wizard is pretty cool until you actually want to modify stuff like this. I am guessing you will have to keep track of which page you're on and then call something like this (which is what you already know):

forward_btn = self.FindWindowById(wx.ID_FORWARD) 
forward_btn.Disable()

You can probably use event.GetPage() to figure out which page you're on. Or you could just re-implement the wizard with some panels and do the switching that way. Personally I think that would be easier. I have an example of panel switching on my blog that might help you.

You might also find this really generic implementation of a Wizard that I came up helpful too.

Upvotes: 3

Related Questions