![]() |
Desktop Development »
Miscellaneous »
General
Intermediate
Magic WizardControl / WizardDialogBy Phil WrightCreate Wizards quickly and easily |
C#, Windows, .NET 1.0, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

WizardControl/WizardDialog Sample contains a example
application that uses shows the MenuControl from the Magic Library. This allows
you to experiment and test out the feature. The actual source code is inside
the separate second download. At nearly 1MB in size, I thought people would
prefer to download the sample before deciding if they want to install the
entire source code project!
WizardControl should be used when you need to guide the user through
a series of steps. Simple examples include creating an installation program or
allowing the creation a new items by answering a series of questions. In most
situations you will want to use a modal dialog to host an instance of the WizardControl.
Rather than create your own Form the library already includes a Form
called WizardDialog. Download the Magic Library and see the relevant
article for more details on how to use the WizardDialog.
Profile property of the control is used to configure the appearance
and operation of the wizard. The three available options are: -
The last page is always used to report the end result of the install attempt.
Therefore the last page will by default only display the Close
button as that is the only possible action. It makes no difference if your page
is reporting a success or failure result the only possible action is to close
down the installation process.
The second to last page is used to perform the actual install action and so the
only available button will be Cancel. Once the install attempt has begun
it makes no sense allowing the user to move Back to previous pages or to
move past the current page. When the install action has completed you should
manually move the wizard onto the last page using the SelectedIndex
property in order to report the outcome.
All the preceding pages are assumed to be used in gathering information from the
user and so the Next and Back buttons will be shown depending on
the appropriate availability. The Cancel
button is always shown so that the user can exit the wizard at this time.
Finish button. A good example
would be adding a new item to your project. Every page has the Cancel, Next,
Back and Finish buttons displayed with the Next and Back
only enabled when appropriate for the selected page. The user can use the Finish
button at any time to accept all the default values and have the custom action
performed immediately. Alternatively they can move through the series of pages
and customize the values.
If you need to enfore some mandatory fields before the Finish button is
enabled then change the EnableFinishButton property to Status.No when
the control is created. Once you notice that all mandatory fields have been
supplied change the property to Status.Yes to allow the user to select
the Finish
button.
Update and Cancel.
Use this profile when the user needs to see and modify a group of related
settings. They can use the Update button to apply the changes in an
appropriate way or use the Cancel
button to discard any changes made.
Update
button are called ShowUpdateButton, EnableUpdateButton and ButtonUpdateText
respectively.
Imagine you are using the Controller profile to present a dialog box of
project settings to the user. The user can move between pages and change the
settings as desired. When they press the Update button you apply those
changes immediately. However, you might prefer to have the button called Apply
rather than Update. Simply set the ButtonUpdateText property to
the required string to change the button text. But you must remember that the
event generated when the button is pressed is still called UpdateClick
.
In another situation you might have a Cofigure profile used to setup a
new item within your project. But you do not want the Cancel button
availale to the user, instead you want to force your user to move through the
whole process and use the Finish button. In this case you would set the ShowFinishButton
property to Status.No which prevents the button from being displayed on
any page. If you need a button displayed all the time then assign the Status.Yes
value to the appropriate button show property. By default each buttons show and
enable properties has the Status.Default value that indicates the
control should calculate the correct state depending on the currently seleted Profile
and page index.
Often you will want to change the displayed/enabled state of buttons on a
per-page basis. In this case you need to hook into the WizardPageEnter and
WizardPageLeaveevents and set the appropriate values depending on the
page selected.
AssignDefaultButton property is defined as False and
so the control will not make any attempt to assign a default button for the Form
the control is contained inside. If you decide to enable this property the
following logic is used to determine which button should become the default.Close and so
this will be used as the default. On the second to last page the only button is Cancel
which is therefore the default. All other pages assign the Next
button as the default.Finish button as the default and all other
pages the Next
button.Update button is always designated the default in this profile.
30 Sept 2002 - Initial Revision
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 29 Sep 2002 Editor: Brian Delahunty |
Copyright 2002 by Phil Wright Everything else Copyright © CodeProject, 1999-2009 Web10 | Advertise on the Code Project |