tool windows disappearing when added through design view

Docking/MDI for Windows Forms Forum

Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
help, I can't get UIStudio's toolwindows to stick around for design view!!!

I am continually getting this problem. Before I was able to just do and redo until it stuck, but now it won't keep any of the tool windows I am adding.

I have a form with 8 existing tool windows on it, and am trying to add another.

To do this I drag a listview to the form, right click it and choose dock control. It then is placed inside a newly created toolwindow and is, at least at this point, visible and dragable.

When I try to run it, however, sometime during the course of running, closing then returning back to the design window the toolwindow along with the control inside it (in this case a listview) are removed from the designer. If I check the code the listview, toolwindow, toolwindowcontainer and dockmanager all appear to be there, however if I run the code again I get an error on some code referencing the toolwindow and intellisense doesn't show that the toolwindow even exists anymore. This even though I verify the toolwindow declaration is intact and has valid syntax.

any help will of course be much appreciated

-Dave

Comments (12)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Can you email us steps to reproduce this in our test application or email us a sample project with steps to reproduce it?


Actipro Software Support

Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
I can't give you my current project's source, and all attempts to recreate it in a virtually empty project are failing. What do you suggest? I can't use it at this point. :(
Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
We have a form that we inherit from to give us added functionality to the windows form, when I threw this into a fresh project and tried it again, I got the same problem. I can't imagine anything short of an override would cause such designer quirkiness but I have looked at our code and can't see any problems. Here is the code for the only 2 overrides we have in our base class for (so far). Maybe you can find something wrong, or copy it into your own project and try to recreate the problem.

/// <summary>
/// Override to provide additional default functionality to Baseline Form control.
/// </summary>
/// <param name="e"></param>
protected override void OnLoad(EventArgs e)
{
if (!DesignMode)
{
//remember who our parent is
_parentInstance = this.MdiParent;

//resume and suspend layouts are for hiding all of the
//video trash from the user.
SuspendLayout();

base.OnLoad (e);

//restore the location of this baseline form
restoreFormLayout();

ResumeLayout();
}
else
{
base.OnLoad (e);
}

}

/// <summary>
/// Override to provide additional default functionality to Baseline Form control.
/// Namely:
/// 1 - saving of form position, size and state
/// </summary>
/// <param name="e"></param>
protected override void OnClosed(EventArgs e)
{
base.OnClosed (e);

if (!DesignMode)
{
//TODO: Must get the app name ("Baseline" in the below string literal)
//from someplace centric.
RegistryKey myKey = Registry.CurrentUser.CreateSubKey(@"Software\BGM\Baseline\BaselineForm\" + this.Name.ToString());

//Save the form size and location if the form is not maximized
if (WindowState != System.Windows.Forms.FormWindowState.Maximized)
{
myKey.SetValue("x",Location.X);
myKey.SetValue("y",Location.Y);
myKey.SetValue("width",Size.Width);
myKey.SetValue("height",Size.Height);
}

//Save maximized state
myKey.SetValue("windowState", (int)WindowState);

//Save the form's MDI Docked status

//flush unwritten values
myKey.Close();
}
}
Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
It looks as though taking out the Suspend and ResumeLayout() commands from within the if (!DesignMode) block fixed the problem. Fixed may not be the right word because I need to keep those statements in there. Maybe this will aid you in fixing the problem though. Let me know if you can recreate it and if/when it will be fixed so I know when I can put my code back in.

-Dave
Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
I spoke too soon. This is still happening. I didn't notice it before because it is an intermittent problem.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
So to dupe this I need to have a base Form and and one that derrives it, right? Which one has the DockManager on it?

Also, why do you need to do all that suspend/resume layout stuff? The Load event fires before the form is displayed.


Actipro Software Support

Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
It's in the derived form.

Supposedly the Load is called before the form is displayed, but that turns out to be a fallacy in actual practice. It might be more apparant when you have lots of stuff on your forms I don't know, but the form is visible for at least part of the form load event. It's probably a latency thing, but whatever it is the suspend and resume make it look as it should.

Anyway, like I said even with those lines gone I'm still experiencing the problem. It appears as though I spoke too soon earlier. It worked once or twice with the removal of those lines, but that's all.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
In your code, what does this line do?
_parentInstance = this.MdiParent;
Are you putting the dock windows on an MDI child form?


Actipro Software Support

Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
Oh, yes I am. Is that not allowed? It works great when you can get the designer to cooperate.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Well in order to duplicate the issue I need to know things like that. We have plenty of customers who have the product working fine. I need to know all the details that cause it to reproduce and using an MDI child could be something that triggers it. Are there any other things about your setup that are non-typical?


Actipro Software Support

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I've made this setup and it's working fine for me. I have a BaseForm class that has the OnLoad override. I have a ChildForm class with the DockManager and 4 tool windows on it. Then I have an MdiParentForm that is an MdiContainer. I show the MdiParentForm and add a ChildForm as an MDI child to it. No issues from what I can see.

I think it would be best if you created a simple project that duplicates the problem and email it and the steps to reproduce the problem to us. It's all working fine with everything I try here.


Actipro Software Support

Posted 19 years ago by Wyatt Albiston - Software Engineer, Bill Good Marketing
Avatar
Ok, it's sent to you with steps.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.