How to update a wizard after adding pages in code?


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I have a wizard that has only a single page at design time, then I add a bunch at runtime (all of which is working great). The only hick-up is that the when the wizard is initially shown, there is no next button only a finish button. The buttons shown are: back (disabled), finish (enabled) and Cancel (enabled). This is correct for a wizard with one page (as it is in design mode).



I'm using a tree view as a second navigation control and when I move to any other page then back to the first page, the buttons are then correct (back, next and cancel all disabled/enabled correctly). So the question is how do I update the wizard so it updates the controls after adding pages in code? I tried Refresh and Update but neither worked.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Just manually set the button status.  There are a lot of factors as to how to control the state of buttons...but you can always overwrite any native behavior by simply setting the button status:

Me.MyWizard.SetNavigationButtonStatus(StrataFrame.UI.WizardNavigationButtons.Next,StrataFrame.UI.WizardNavigationButtonStatus.Enabled)

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks! I also had to hide the finish button and show the next button so my code looked like:

Me.MyWizard.cmdFinish.Navigation.Visible = False
Me.MyWizard.Navigation.cmdNext.Visible = True
Me.MyWizard.SetNavigationButtonStatus(StrataFrame.UI.WizardNavigationButtons.Next,StrataFrame.UI.WizardNavigationButtonStatus.Enabled)

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
One thing you can do here is set the Navigation type of a page to FinishPage.  This will force the page to be a Finish page rather than just being the last page in the collection.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'll have to get to that soon, but the problem I was having was that I had a single page defined at run time, so I'm guessing that the wizard automatically made it the finish page. When I showed the wizard, I added a bunch of pages (50+), but the first page was likely still marked as being the finish page....hmmm...so maybe I can either set the navigation type of the first page to normal. Also, can there only be one finish page? (then setting another would clear the first page, right?)
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You can have as many Finish pages as you want.  Which only makes sense in the event that you have different endings based on what pages are selected within the wizard.  But by default, all pages NavigationType is Automatic, so only the last page will be a Finish page.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search