Click here to Skip to main content
15,860,859 members
Articles / Programming Languages / Visual Basic
Article

GN Wizard Framework

Rate me:
Please Sign up or sign in to vote.
4.73/5 (51 votes)
21 Dec 2006CPOL3 min read 174.7K   1.7K   94   63
A simple Wizard framework.

Image 1

Introduction

This article will help you give your application a common wizard interface. One of the main reasons wizards were invented was to make common tasks easier to work with.

Background

The idea for my wizard came soon after I realized I was reproducing code to do the same thing again and again! As working with database applications is my main job, the need for wizard based procedures kept arising more and more. I felt the need to create a common wizard interface to suit my needs.

Implementation

Just drop the WizardTemplate control on a form, and you are ready to go.

Usage

  • Add the control to the toolbox (GNWizardFrameWork.dll).
  • Drop the WizardTemplate on a WinForm.
  • Add the pages
  • You are done!

Points of interest

The wizard component is written in VB.NET and inherits from UserControl. Attached to the wizard is a 3DLine control.

Page Layouts

Wizards usually have two different page layouts, one for exterior pages (the main/welcome page), and one for interior pages (the individual steps within the first and last pages).

Exterior Pages

Exterior pages usually have a sidebar graphic with a boxed logo. The GNWizardFramework doesn't support this; instead, I have made the exterior page as a blank canvas so the developer can set the complete layout, and not be limited to having a sidebar they might not want.

Interior Pages

The interior pages are pretty much the same as the exterior pages except for a few minor alterations. Firstly, as exterior pages fill the whole wizard except for the button bar based at the bottom of the wizard, the interior pages have a header panel, and the working panel locations is compensated by a header.

PageStyle enum

  • eWPS_Interior

    The wizard and page should be formatted as an interior page.

  • eWPS_Exterior

    The wizard and page should be formatted as an exterior page.

Image 2

Image 3

How the code is brought together

The wizard consists of three classes and two controls:

Class/ControlDescription
WizardTemplateDesigner (class)Designer for the Wizard template
WizardPage (class)Wizard page item
WizardPageCollection (class)Holds all the WizardPage details, and handles all events passed by a WizardPage
WizardTemplate (control)Wizard control
ThreeDLine (control)Simple 3D line control

Handling buttons

All pages (interior and exterior) have their own button handlers. Buttons can be accessed by the page you want to change or set:

VB
WelcomePage.HasNextButton = True
WelcomePage.HasPreviousButton = False
WelcomePage.HasCancelButton =True
WelcomePage.HasFinishButton = False

Main Features

  • Easy to use: Simple design-time interface.
  • GUI: An easy to use GUI, what you see at design-time is what you see at runtime.
  • PC Support: Works under (tested so far) Win95/98, WinXP, Win2000, and Win2003 Server

Other Features

  • Runtime customization: You can change any part of the wizard at runtime.
  • Attach/add pages at runtime:
    VB
    'Inserting a custom page At runtime:
    
    '-- Inserts A New Page after the Current Page
    WizardTemplate.Pages.Insert(_
      WizardTemplate.Pages.IndexOf(CurrentWizPanel) + 1, _
      NewWizardPage)
    
    'Adding a custom page At runtime:
    '-- Adds A New Page To The End Of The wizard
    WizardTemplate.Pages.Add(NewWizardPage)

Conclusion

Not much here to learn from, but hopefully the library will be of some use. As this is my first article, please be lenient. I hope all of you at least enjoyed reading the article, and maybe you'll find the framework useful.

Licence (LGPL)

The GNWizardFramework library is copyright 2005-2006 to Gary Noble, but its source code and the binaries are free for commercial and non commercial use.

Only vote for this article if you like the library.

History

  • 1.01 (21-Dec-2006)
    • Updated the 'Previous Button' disabled issue pointed out by Bill Reinhold (Thanks Bill).
    • Updated the 'Toolbox bitmap' - Toolbox bitmaps are now handled properly.
  • 1.0 (21-Mar-2006) - Initial release.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWaste of time, author does not support. Incomplete method set to be of any use. Pin
Member 1068094430-Sep-19 9:15
Member 1068094430-Sep-19 9:15 
GeneralSet Focus of Next, Cancel and Finish Pin
jacodutoit5-Mar-08 20:46
jacodutoit5-Mar-08 20:46 
GeneralRe: Set Focus of Next, Cancel and Finish Pin
jacodutoit6-Mar-08 22:34
jacodutoit6-Mar-08 22:34 
GeneralOnMovePrevious, OnBeforeMoveNext Pin
emblabac15-Jan-08 4:58
emblabac15-Jan-08 4:58 
GeneralRe: OnMovePrevious, OnBeforeMoveNext Pin
Niyazi Yarar18-Oct-11 10:54
Niyazi Yarar18-Oct-11 10:54 
QuestionTrap button clicks? Pin
AIroff22-Nov-07 23:18
AIroff22-Nov-07 23:18 
QuestionUsage Pin
stixoffire13-Nov-07 18:43
stixoffire13-Nov-07 18:43 
AnswerRe: Usage Pin
Gary Noble13-Nov-07 22:17
Gary Noble13-Nov-07 22:17 
QuestionSpanish text for buttons (next, back, ...) Pin
amarino6-Oct-07 13:17
amarino6-Oct-07 13:17 
QuestionEvent OnMovePrevious Pin
patmorier1-Oct-07 23:49
patmorier1-Oct-07 23:49 
GeneralControls disappear when added to a Wizard Page Pin
Lonny Angell6-Aug-07 4:12
Lonny Angell6-Aug-07 4:12 
GeneralRe: Controls disappear when added to a Wizard Page Pin
MrPalermo1-Dec-07 13:53
MrPalermo1-Dec-07 13:53 
QuestionBest method to skip pages? Pin
Phil Jeffrey1-Aug-07 17:32
Phil Jeffrey1-Aug-07 17:32 
GeneralProblems when using DPI 120 Pin
Geert van Horrik21-Jun-07 2:42
Geert van Horrik21-Jun-07 2:42 
GeneralRe: Problems when using DPI 120 Pin
Gary Noble21-Jun-07 4:45
Gary Noble21-Jun-07 4:45 
Can you elaborate on the problems you are having?

GeneralRe: Problems when using DPI 120 Pin
Geert van Horrik21-Jun-07 4:52
Geert van Horrik21-Jun-07 4:52 
GeneralRe: Problems when using DPI 120 Pin
Gary Noble21-Jun-07 5:04
Gary Noble21-Jun-07 5:04 
GeneralRe: Problems when using DPI 120 Pin
Geert van Horrik21-Jun-07 5:27
Geert van Horrik21-Jun-07 5:27 
GeneralRe: Problems when using DPI 120 Pin
Gary Noble21-Jun-07 5:48
Gary Noble21-Jun-07 5:48 
GeneralRe: Problems when using DPI 120 Pin
Geert van Horrik21-Jun-07 5:50
Geert van Horrik21-Jun-07 5:50 
GeneralDesigner Bug Pin
dwpmartin19-Jan-07 6:51
dwpmartin19-Jan-07 6:51 
QuestionIs this a bug?? Pin
wreinhold20-Dec-06 9:42
wreinhold20-Dec-06 9:42 
AnswerRe: Is this a bug?? Pin
Gary Noble20-Dec-06 22:07
Gary Noble20-Dec-06 22:07 
GeneralRe: Is this a bug?? Pin
wreinhold21-Dec-06 1:30
wreinhold21-Dec-06 1:30 
QuestionAdd to toolbar problem [modified] Pin
wreinhold15-Dec-06 4:07
wreinhold15-Dec-06 4:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.