|
Try setting the CurrentStepIndex property of your WizardControl to go to any step of your wizard.
Example :
' Goto to Step #1 of my WizardControl1
WizardControl1.CurrentStepIndex=3
|
|
|
|
|
I've been trying to use this as WizardControl1.CurrentStepIndex = WizardPage.StepIndex; and my StepIndex is always -1, thus preventing me from going any further.
I also can't seem to get it to work to set the CurrentStepIndex to the finish page.
|
|
|
|
|
What event do I use after the steps is loaded?
|
|
|
|
|
What's the easiest way to share improvements? I changed it so that the buttons along the bottom use a flow layout that is right-aligned, allowing you to set the visibility of these buttons and still have the buttons align as you expect (i.e. as if they were never there). I'd love to share the addition with the group.
|
|
|
|
|
Some time ago I was creating application in wizzard style look, but was needed to make it more complicated. The only way to do this was using tabcontrol. Simple and easy, the only problem is look:
- hide tab buttons -> simple add panel with some graphics to the top an over this buttons, it also dissalow switch tabs by mouse for user ( tip: adjust height in code and you can use tab buttons in design time)
- do not allow switching tabs by keys -> solution found on this site - using code
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {<br />
if (ActiveControl is TabControl) {<br />
if (System.Convert.ToBoolean(keyData & Keys.Tab | Keys.Control)) return true;<br />
}<br />
return base.ProcessCmdKey (ref msg, keyData);<br />
}
Maybe I write article for this, but my english is not so good...
|
|
|
|
|
Hello and thanks for the great control.
I'm making an application where a user enters some parameters, then clicks next, and on the next step I'd like to show the user a progress bar as some actions are performed.
In the control it only seems there's an event that fires when the step index changes and when the next button is clicked. I tried both but they perform the actions THEN show the step.
Is there any way to fire an event AFTER a step is loaded?
Thanks in advance
|
|
|
|
|
The CurrentStepIndexChanged event works for me, but you have to force a refresh of your WizardControl.
Here's an example in VB :
Sub StepHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WizardControl1.CurrentStepIndexChanged
Select Case WizardControl1.CurrentStepIndex
Case 1 ' My progress step
WizardControl1.BackButtonVisible = False
WizardControl1.NextButtonVisible = False
WizardControl1.CancelButtonVisible = False
WizardControl1.Refresh()
ProgressBar1.Maximum = 100000
ProgressBar1.Step = 1
For x = 1 To ProgressBar1.Maximum
ProgressBar1.PerformStep()
' Do your stuff here
Next
WizardControl1.CurrentStepIndex = 2
Case 2 ' My finish step
WizardControl1.BackButtonVisible = False
WizardControl1.NextButtonVisible = True
WizardControl1.CancelButtonVisible = False
End Select
End Sub
Hope this could help
|
|
|
|
|
Hi
I've noticed an issue when adding a subtitle, I deleted the subtitle and then accidently moved off of the subtitle property, when I went back to add a subtitle it would not display any text that I'd typed in and also cleared the subtitle property.
I will investigate this issue later but just wanted know if anybody else had experinced this or even fix it!
|
|
|
|
|
|
Hi Manish
Very good piece of code for sure! (I m finding that where can i vote )
Btw, i would really love to see this project as an article, explaining all approaches you followed to create this control.
|
|
|
|
|
Next update will explain all the things. But give me some time. I am working for another excellent article...
|
|
|
|
|
This is grate! What that article is all about? By the way, do you have any plans to put this code on sourceforge.net as public project? I think this wizard control has a big potential.
|
|
|
|
|
I dont have much idea of sourceforge.net if you have some idea probably you can help me. Thanks in advance.
|
|
|
|
|
|
Thanks a lot i will look into this.
|
|
|
|
|
This is very nice work.
I tested the wizard control yesterday, and apart from a few small things, it worked perfectly. The few improvement suggestions I have are the following:
1) There should be a FinishButtonEnabled property. You might not want the button to be enabled before the user has performed some kind of action on the last page.
2) If I set the HelpButtonVisible to False, I would like the other buttons to align to the right so that I don't have the big space where the help button normally is.
3) I want the intermediate step and the finish step to have the same look as the start step - i.e. with an image on the left hand side. So I set the Binding Image to the supplied Left.png (the same that is used in the start step). But it didn't work. The image was stretched to be a top aligned banner like the one that was already there in the intermediate step.
All of these things I'm sure I can fix myself editing the source, but I thought I'd tell about them. It might be a good improvement for future versions.
Apart from these little issues, thank you very much for a nice control.
Cheers,
Johnny J.
|
|
|
|
|
Thanks a lot.
For the first one use NextButtonEnabled property.
I will definately look into these issue.
|
|
|
|
|
Very well done - and thank you for sharing. This saved me a lot of time.
One suggestion - a method to set the current step.
|
|
|
|
|
I have a textbox and a label on an intermediate step. It's position is set like so:
<br />
this.label1.AutoSize = true;<br />
this.label1.Location = new System.Drawing.Point(13, 89);<br />
this.label1.Name = "lblGroupName";<br />
this.label1.Size = new System.Drawing.Size(70, 13);<br />
this.label1.TabIndex = 0;<br />
this.label1.Text = "Group Name:";<br />
<br />
this.txtGroupName.Anchor = System.Windows.Forms.AnchorStyles.None;<br />
this.txtGroupName.Location = new System.Drawing.Point(212, 82);<br />
this.txtGroupName.Name = "txtGroupName";<br />
this.txtGroupName.Size = new System.Drawing.Size(478, 20);<br />
this.txtGroupName.TabIndex = 1;<br />
But when the wizard runs, the textbox is way down and right of where it should be. The label remains exactly where it should be.
Can anyone point me to where I can troubleshoot the issue?
|
|
|
|
|
I have a similar issue. It has to do with the Anchor property of controls, put inside a WizardStep. If I set control's (e.g. GroupBox) Anchor = Top, Bottom, Left to a it looks OK in design time, but at runtime it gets stretched way down, below the border of the wizard step. The problem occurs not only with the Top-Bottom anchoring, but with the Right anchor, too.
It seems to me that when the position of the controls is determined, the container control is somehow at its maximum size (not the size I see in the designer).
UPDATE: I debugged the problem with a simple scenario: an intermediate step (middleStep) and of a groupbox in it. Initially the middleStep's size is (0,0). When adding it to the wizardStepsPanel.Controls in WizardControl.DoReLayout() the middleStep size changes to the container's size, but the groupbox expands too much.
Initial:
demoWizard.Size {Width = 524 Height = 394}
middleStep.Size {Width = 0 Height = 0}
groupBox1.Size {Width = 50 Height = 100}
After DoReLayout():
demoWizard.Size {Width = 524 Height = 394}
middleStep.Size {Width = 524 Height = 354}
groupBox1.Size {Width = 574 Height = 454}
It is easy to notice that final groupBox1.Size = initial groupBox1.Size + middleStep.Size.
A quick workaround is to set the initial wizard step size, without affecting the controls in it. We can add and call the following method: ResizeProperlyAllWizardSteps() just after the wizard control is initialized:
<br />
<br />
public void ResizeProperlyAllWizardSteps()<br />
{<br />
Size size = wizardStepsPanel.Size;<br />
foreach(WizardStep step in wizardStepCollection)<br />
{<br />
ResizeWizardStepWithoutAffectingControls(step, size);<br />
}<br />
}<br />
<br />
private static void ResizePageWithoutAffectingControls(WizardStep step, Size size)<br />
{<br />
if(step.Size == size)<br />
return;<br />
<br />
Control[] controls = new Control[step.Controls.Count];<br />
step.Controls.CopyTo(controls, 0);<br />
<br />
step.Controls.Clear();<br />
<br />
step.Size = size;<br />
<br />
step.Controls.AddRange(controls);<br />
}
NOTE: Unfortunately at design time sometimes the controls' size and location get changed. I suppose that a similar fix can be applied, but don't have the time to investigate.
-- modified at 4:14 Tuesday 29th May, 2007
-- modified at 6:36 Tuesday 29th May, 2007
-- modified at 12:24 Tuesday 29th May, 2007
Ivan Mitev
|
|
|
|
|
Actually, I don't believe the size of the step container is set at all. It looks like the default value is very small (e.g. 0,0) and the anchors are set from there. In any case, I've been farting with the same problem, although I took a different path with my solution.
I added a DockedControl property to the IntermediateStep control. If you assign this control, it's "docked" below the title/header information. There's some smoke and mirrors in there, but it solves the issue with sizing and the step containers. Make it a panel or similar container and the controls you place inside that panel should now follow the proper anchoring/docking behavior.
Here's the details. I'd be happy to post the code, if I had a good place to put it,
Added the following code to IntermediateStep, including a call to InitializeComponent() below:
///
/// Height of the header information.
///
private int HEADER_HEIGHT = 60;
// Control specifically noted for docking within the step.
// This allows us to dock it under all the title information
// at the top.
private Control mDockedControl = null;
///
/// Initialize the component.
///
private void InitializeComponent()
{
SizeChanged += new System.EventHandler(
IntermediateStep_SizeChanged);
}
///
/// Resize any "docked" controls so that they continue to appear
/// docked (under the header).
///
///
/// <param name="sender" />
/// sender
///
/// <param name="e" />
/// e
///
private void IntermediateStep_SizeChanged(
object sender, System.EventArgs e)
{
if (mDockedControl != null)
{
mDockedControl.Size =
new Size(Size.Width, Size.Height - HEADER_HEIGHT);
}
}
///
/// This control will be docked under the header information
/// shown in the step.
///
[Description("Specify a control to dock under the header information."), Category("Layout")]
public Control DockedControl
{
get
{
return mDockedControl;
}
set
{
mDockedControl = value;
// Make it looked docked.
if (mDockedControl != null)
{
mDockedControl.Location =
new Point(0, HEADER_HEIGHT + 1);
mDockedControl.Size =
new Size(Size.Width, Size.Height - HEADER_HEIGHT);
}
}
}
-- Ken Wootton
|
|
|
|
|
Thanks Ken,
Your workaround worked for me, even though it was not very easy to apply those changes in an existing wizard with 7 pages.
I actually moved your suggested code to the WizardStep base class (instead of IntermediateStep) and made minor modifications, which I post here:
<br />
protected int HEADER_HEIGHT = 60;<br />
protected int FOOTER_HEIGHT = 0;<br />
protected int LEFT_MARGIN_WIDTH = 0;<br />
<br />
private void InitializeComponent()<br />
{<br />
SizeChanged += WizardStep_SizeChanged;<br />
}<br />
<br />
private void WizardStep_SizeChanged(object sender, EventArgs e)<br />
{<br />
if (mDockedControl != null)<br />
{<br />
mDockedControl.Size = new Size(<br />
Size.Width - LEFT_MARGIN_WIDTH,<br />
Size.Height - HEADER_HEIGHT - FOOTER_HEIGHT);<br />
}<br />
}<br />
<br />
[Description("Specify a control to dock under the header information.")]<br />
[Category("Layout")]<br />
public Control DockedControl<br />
{<br />
get { return mDockedControl; }<br />
set<br />
{<br />
mDockedControl = value;<br />
<br />
if (mDockedControl != null)<br />
{<br />
mDockedControl.Location = new Point(LEFT_MARGIN_WIDTH, HEADER_HEIGHT);<br />
mDockedControl.Size =<br />
new Size(Size.Width - LEFT_MARGIN_WIDTH, Size.Height - HEADER_HEIGHT - FOOTER_HEIGHT);<br />
}<br />
}<br />
}
That's how I can just set in StartStep: LEFT_MARGIN_WIDTH = 180; and analogically set FOOTER_HEIGHT in the FinishStep.
Ivan Mitev
|
|
|
|
|
Ah. Does that make the docked property available on all pages, including the start page? At the time I wrote the previous code, I didn't realize this problem occasionally happens with the start page as well. Next time I touch that code, I'll have to apply your update.
|
|
|
|
|
Yes, this issue affects all pages (including Start and Finish). Putting the DockedControl property in the base class solves the problem.
My previous workaround worked only when resizing the current page, while the others pages didn't respond to the resizing.
Ivan Mitev
|
|
|
|
|
I have an easier solution that solves this problem. Simply open up WizardStep.cs and find the Size property. Change the DesignerSerializationVisibility.Hidden to DesignerSerializationVisibility.Visible. This will force the step size to be added to the designer generated code and the anchors will work.
This works best if you are adding a new WizardControl to a form. If you existing WizardControl and don't feel like remaking it, just add a step and then remove it and the designer code should update itself with the Size in there.
|
|
|
|