Home All Groups Group Topic Archive Search About

Best practices for creating a "wizard"

Author
31 Aug 2006 3:11 PM
redeagle
I'm wondering what the best practice is for creating a WinApp "wizard" that
contains 4 or 5 "steps".  Options so far are

1) Single WinForm making various controls visible/non visible at the
different steps(although that may get cluttered in the design environment)

2) Create multiple WinForms (don't really know any pros or cons of this
method)

3) Use a tabbed page (although I don't want to see any tabs)

Any thoughts?

John

Author
31 Aug 2006 3:21 PM
Miro
Maybe Use Panels.

Pop a bunch of Panels overtop of eachother.
Right click on them and say "Bring to front" when in the design environment.

As ur wizard runs then you can visible = false and visible = true on them.

It would keep it all on one form for you.
Have one button outside of the Panel on the bottom that says "next"
and one that says "back"
show and hide them depending on what the person selects or which panel is
visible.

-Just a thought.
-But it would get around seeing "tabs".
-That would solve issue 1 cause u only have to hide and show 1 object.


Miro


Show quoteHide quote
"redeagle" <redea***@discussions.microsoft.com> wrote in message
news:42831010-5FB3-4D92-88C8-FB16EFC84D0A@microsoft.com...
> I'm wondering what the best practice is for creating a WinApp "wizard"
> that
> contains 4 or 5 "steps".  Options so far are
>
> 1) Single WinForm making various controls visible/non visible at the
> different steps(although that may get cluttered in the design environment)
>
> 2) Create multiple WinForms (don't really know any pros or cons of this
> method)
>
> 3) Use a tabbed page (although I don't want to see any tabs)
>
> Any thoughts?
>
> John
Author
31 Aug 2006 3:24 PM
Mike McIntyre
You can also use multiple Panel controls on a single Form, each a 'page' of
the wizard.  Panels are shown/hidden as the user navigates the wizard.

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com


Show quoteHide quote
"redeagle" <redea***@discussions.microsoft.com> wrote in message
news:42831010-5FB3-4D92-88C8-FB16EFC84D0A@microsoft.com...
> I'm wondering what the best practice is for creating a WinApp "wizard"
> that
> contains 4 or 5 "steps".  Options so far are
>
> 1) Single WinForm making various controls visible/non visible at the
> different steps(although that may get cluttered in the design environment)
>
> 2) Create multiple WinForms (don't really know any pros or cons of this
> method)
>
> 3) Use a tabbed page (although I don't want to see any tabs)
>
> Any thoughts?
>
> John
Author
31 Aug 2006 3:54 PM
Oenone
Hi John,

redeagle wrote:
> I'm wondering what the best practice is for creating a WinApp
> "wizard" that contains 4 or 5 "steps".

I spent a lot of time working on a good solution to this and settled on the
following:

Use a single form with a TabControl on it. This is far easier than multiple
forms. Using a TabControl allows you to organise each of your "pages" easily
without having to muck around with hidden and/or overlapping panels or
anything like that. You can set the Text property for each TabPage in order
to get the name to appear in the tab header at design time, making it much
easier to know which wizard page is which.

When your form opens, set the properties of the TabControl as follows:

\\\
    TabControl.Appearance = TabAppearance.FlatButtons
    TabControl.Multiline = False
    TabControl.SizeMode = TabSizeMode.Fixed
    TabControl.ItemSize = New Size(0, 1)
///

This will cause all of the tab imagery to disappear. The tabs themselves
will now be completely invisible.

However there is one final issue. Pressing Ctrl+Tab and Ctrl+Shift+Tab will
cycle back and forth through all the tabs in the TabControl -- not what you
want, I'm sure. You can resolve this by adding the following code to your
form:

\\\
    Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
Boolean

        'Prevent Ctrl+Tab or Ctrl+Shift+Tab from affecting the TabControl's
selected tab
        If keyData = (Keys.Control Or Keys.Tab) OrElse keyData =
(Keys.Control Or Keys.Shift Or Keys.Tab) Then
            'Indicate that we've handled this keypress
            Return True
        End If

        Return MyBase.ProcessCmdKey(msg, keyData)

    End Function
///

(That will probably wrap badly, sorry).

This will handle all Ctrl+Tab and Ctrl+Shift+Tab keypresses within the form
and will swallow them up without doing anything.

I've used this to create several wizard form and have found it to be a very
easy and flexible way of developing such a form.

Hope that helps,

--

(O)enone
Author
31 Aug 2006 4:43 PM
Heikki Leivo
> redeagle wrote:
>> I'm wondering what the best practice is for creating a WinApp
>> "wizard" that contains 4 or 5 "steps".
>
> I spent a lot of time working on a good solution to this and settled on
> the following:

Thanks for the hint, I have an oncoming wizard project too :-)

-h-
Author
31 Aug 2006 4:44 PM
redeagle
Right on.  Sounds like a good plan... I'll give that a whirl.

Thanks!

Show quoteHide quote
"Oenone" wrote:

> Hi John,
>
> redeagle wrote:
> > I'm wondering what the best practice is for creating a WinApp
> > "wizard" that contains 4 or 5 "steps".
>
> I spent a lot of time working on a good solution to this and settled on the
> following:
>
> Use a single form with a TabControl on it. This is far easier than multiple
> forms. Using a TabControl allows you to organise each of your "pages" easily
> without having to muck around with hidden and/or overlapping panels or
> anything like that. You can set the Text property for each TabPage in order
> to get the name to appear in the tab header at design time, making it much
> easier to know which wizard page is which.
>
> When your form opens, set the properties of the TabControl as follows:
>
> \\\
>     TabControl.Appearance = TabAppearance.FlatButtons
>     TabControl.Multiline = False
>     TabControl.SizeMode = TabSizeMode.Fixed
>     TabControl.ItemSize = New Size(0, 1)
> ///
>
> This will cause all of the tab imagery to disappear. The tabs themselves
> will now be completely invisible.
>
> However there is one final issue. Pressing Ctrl+Tab and Ctrl+Shift+Tab will
> cycle back and forth through all the tabs in the TabControl -- not what you
> want, I'm sure. You can resolve this by adding the following code to your
> form:
>
> \\\
>     Protected Overrides Function ProcessCmdKey(ByRef msg As
> System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As
> Boolean
>
>         'Prevent Ctrl+Tab or Ctrl+Shift+Tab from affecting the TabControl's
> selected tab
>         If keyData = (Keys.Control Or Keys.Tab) OrElse keyData =
> (Keys.Control Or Keys.Shift Or Keys.Tab) Then
>             'Indicate that we've handled this keypress
>             Return True
>         End If
>
>         Return MyBase.ProcessCmdKey(msg, keyData)
>
>     End Function
> ///
>
> (That will probably wrap badly, sorry).
>
> This will handle all Ctrl+Tab and Ctrl+Shift+Tab keypresses within the form
> and will swallow them up without doing anything.
>
> I've used this to create several wizard form and have found it to be a very
> easy and flexible way of developing such a form.
>
> Hope that helps,
>
> --
>
> (O)enone
>
>
>
Author
31 Aug 2006 10:02 PM
Mick Doherty
If you take a look at my site you'll find source code for a PanelManager.
This was designed specifically for this purpose.
http://www.dotnetrix.co.uk/custom.html
....note that in VS2005 you will need to create a Control library containing
the PanelManager and use it via the dll, as there are bugs in the IDE which
cause the SelectedPanel property to lose reference to the Panels (after a
rebuild) when it's part of the same solution.

You'll also find an example showing how to create a customised TabControl
which allows you to turn the Tabs off.
http://www.dotnetrix.co.uk/tabcontrols.html

Another option you have is to use usercontrols and load them up at runtime.
This has the advantage that each usercontrol can be designed seperately.

There's also a several Wizard Controls on CodeProject.

Show quoteHide quote
"redeagle" <redea***@discussions.microsoft.com> wrote in message
news:42831010-5FB3-4D92-88C8-FB16EFC84D0A@microsoft.com...
> I'm wondering what the best practice is for creating a WinApp "wizard"
> that
> contains 4 or 5 "steps".  Options so far are
>
> 1) Single WinForm making various controls visible/non visible at the
> different steps(although that may get cluttered in the design environment)
>
> 2) Create multiple WinForms (don't really know any pros or cons of this
> method)
>
> 3) Use a tabbed page (although I don't want to see any tabs)
>
> Any thoughts?
>
> John
Author
1 Sep 2006 1:55 AM
GhostInAK
Hello redeagle,

Wizards are best created very carefully.  The ingredients you use are critical
to the output.  Should you choose to create a wizard using holly berries,
twigs, the blood of a wood elf, and the hair of a druid.. your wizard will
probably have an affinity for nature.  These Hippy Wizards are a a bane on
society and should be avoided at all costs.  Should you manage to create
a Hippy Wizard.. I'll be sure to visit hime, and you, with fireball in hand.

-Boo

Show quoteHide quote
> I'm wondering what the best practice is for creating a WinApp "wizard"
> that contains 4 or 5 "steps".  Options so far are
>
> 1) Single WinForm making various controls visible/non visible at the
> different steps(although that may get cluttered in the design
> environment)
>
> 2) Create multiple WinForms (don't really know any pros or cons of
> this method)
>
> 3) Use a tabbed page (although I don't want to see any tabs)
>
> Any thoughts?
>
> John
>
Author
1 Sep 2006 1:18 PM
Herfried K. Wagner [MVP]
"redeagle" <redea***@discussions.microsoft.com> schrieb:
> I'm wondering what the best practice is for creating a WinApp "wizard"
> that
> contains 4 or 5 "steps".  Options so far are
>
> 1) Single WinForm making various controls visible/non visible at the
> different steps(although that may get cluttered in the design environment)
>
> 2) Create multiple WinForms (don't really know any pros or cons of this
> method)
>
> 3) Use a tabbed page (although I don't want to see any tabs)

The simplest solution is IMO to create usercontrols for the wizard pages.
However, there are other possible solutions too:

<URL:http://www.codeproject.com/cs/miscctrl/tswizard.asp>
<URL:http://www.codeproject.com/cs/miscctrl/ak_wizard.asp>
<URL:http://www.codeproject.com/cs/miscctrl/magicwizard.asp>
<URL:http://www.sellsbrothers.com/tools/genghis/>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>