Dynamically insert wizard pages at runtime


Author
Message
Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
I'm trying to create a prototype for an application we're designing. I'm thinking of using the Wizardcontrol heavily. However, there will be a lot of need for conditionally/dynamically inserting/removing pages based on previous wizard steps. Can you give me a quick tutorial on this? I looked at the SampleWizard form in the UIControlsSample download and I saw this capability mentioned but could not find an example. Thanks in advance.



- Randy
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
Randy,

There are a lot of things that can be done with the Wizard control and it is designed to make adding pages and inserting pages very easy, both within the designer and at run-time.  The first thing you need to learn about is the control designer (shown in the image below).

This is opened using the little arrow at the top right of the control when selected.  In addition to creating a page on a form, you can create a page class which can then be added by selecting the "Existing Page" option.  To create a classable page, create a new item through the solution explorer and choose the SF Wizard Page template.

There are a number of functions on a wizard control to change the state of buttons and dynamically insert pages.  The first thing to learn about is the PageCollection property which houses all of the pages.  You can programmatically Add, Remove, and Insert pages.  This is just a collection and has all features as such.

Me.WizardControl1.PageCollection.Add(MyPage)
Me.WizardControl1.PageCollection.Insert(2, MyPage)

There are other methods to control the button states programmatically.

Me.WizardControl1.SetNavigationButtonStatus(WizardNavigationButtons.Next,WizardNavigationButtonStatus.Enabled)

In addition to all of the methods and properties that can be set, there are events on both a page and on the wizard control itself.

Page Events

  • BackClicked
  • NextClicked
  • PageActivated

Wizard Control Events

  • BackClicked
  • CancelClicked
  • NextClicked
  • FinishClicked
  • NextClicked
  • PageActivated

This is just a basic overview.  But the best thing is to create a project and play with the properties and page settings.  There is also a sample in the Samples and Solutions section of the forum that has a wizard example within it.  It is the UI Control sample. http://forum.strataframe.net/Topic1988-17-1.aspx

Hope this gets you started.  Let me know if you have more questions.


Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Thanks. Yeah, this is a powerful set of classes. Bet you guys had fun creating this BigGrin
Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Trent L. Taylor (08/10/2006)
To create a classable page, create a new item through the solution explorer and choose the SF Wizard Page template.




When I try this I get "Object Reference Not set to an instance of an object" when I try to view in the visual designer.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Thanks for the heads up... I'll check it out.
Randy Jean
Randy Jean
StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)StrataFrame User (233 reputation)
Group: StrataFrame Users
Posts: 105, Visits: 641
Another wizard question:

Is there a way to force the Next button to be enabled even though it "thinks" it's on the last page. I tried



Me.WizardControl1.SetNavigationButtonStatus(WizardNavigationButtons.Next,WizardNavigationButtonStatus.Enabled)



in the PageActivate of the last page but it continued to be disabled.



Thanks,

Randy
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 insert a blank page after your "real" last page.  Just handle the NextClicked event and prevent it from going to that page.  The control inheriantly disallows end-users from "hurting" themselves by automatically taking account of the last page.  Another option is to just change the text of the finish button.  You can also set the "ShowFinishButtonAsDistinctButton" property to false.  This way the Next and finish buttons share the same space and will never be disabled.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We've been able to reproduce the problem and are working on a fix, Jean.  We'll make sure the fix makes it into the next version.
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