For any control that is added to the docking system via FloatControl() at runtime, the docking manager consitently throws an exception when I try to get rid of the control. As you suggested, I am getting rid of the control during idle processing. The exception occurs when I make SetEnableDocking(ctl,false). I get "NullReference: Object reference not set to a valid instance of an object" even though ctl is non-null. The stack trace is:
Syncfusion.Windows.Forms.Tools.DockHostController.TransitToPrevDock()
at Syncfusion.Windows.Forms.Tools.DockingManager.SetEnableDocking(Control ctrl, Boolean value)
This is driving me nuts. I need a solution.
RP
Ramesh Praveen
Syncfusion Team
March 13, 2003 07:18 PM UTC
Thomas,
What version are you testing this against? I couldn't get to reproduce this in our MDIDemo sample, could you please provide more info. I am not sure if you were in touch with some one else regarding this.
Regards,
Praveen Ramesh
TA
Thomas A. Anderson, Program Writer
March 13, 2003 08:45 PM UTC
I am using version 1.5.2.0
I add the floating window to the docking system as follows (sorry about formatting):
private void label1_Click(object sender, System.EventArgs e) {
TreeView tvNew=new TreeView();
Controls.Add(tvNew);
dockingManager1.FloatControl(tvNew,new Rectangle(Bounds.Left+50,Bounds.Top+50,Bounds.Width-100,Bounds.Height-100));
dockingManager1.SetDockLabel(tvNew,"Test!");
dockingManager1.SetCloseButtonVisibility(tvNew,true);
}
When the user clicks the close button, I want to destroy the window. I'm not sure how to handle this. My first approach was as follows:
private void dockingManager1_DockVisibilityChanged(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs arg) {
dockingManager1.SetEnableDocking(arg.Control,false);
arg.Control.Dispose();
Controls.Remove(arg.Control);
}
The SetEnableDocking() call will always throw an exception. In a previous thread on this newsgroup, a SyncFusion employee suggested that I execute this cleanup code at Idle time instead of in the VisibilityChanged handler. I tried this, but with the same result. Please tell me how to dispose of a floating control. If possible, I'd like to do this with version 1.5.2.0 instead of upgrading or waiting for a patch. If I upgrade, I know I'll have a debugging nightmare on my hands since most 3rd party components aren't fully backward compatible.
David
PS
Prakash S
Syncfusion Team
March 17, 2003 04:21 AM UTC
Hi David,
We haven't been able to reproduce the problem with v 1.5.2.0. Seems to work fine in a sample that I just put together. Appended is the relevant code that adds and removes the floating controls in response to a button click.
private TreeView tvNew = null;
private void button1_Click(object sender, System.EventArgs e)
{
this.tvNew=new TreeView();
this.dockingManager1.FloatControl(this.tvNew,new Rectangle(Bounds.Left+50,Bounds.Top+50,Bounds.Width-100,Bounds.Height-100));
this.dockingManager1.SetDockLabel(this.tvNew,"Test!");
// Workaround - Initializing through FloatControl does not update the window text.
this.tvNew.TopLevelControl.Text = "Test!";
dockingManager1.SetCloseButtonVisibility(this.tvNew,true);
}
private void button2_Click(object sender, System.EventArgs e)
{
this.dockingManager1.SetEnableDocking(this.tvNew,false);
Controls.Remove(this.tvNew);
this.tvNew.Dispose();
}
If you can send us a small sample project that exhibits the behavior, we will look into the issue and provide you with an update as soon as possible.
Prakash
Syncfusion
TA
Thomas A. Anderson, Program Writer
March 17, 2003 02:15 PM UTC
see attached file for sample that reproduces the error...Or download from this Url:
http://temp.codefanatic.com/20030317/DockFrock.zip
TA
Thomas A. Anderson, Program Writer
March 19, 2003 01:01 PM UTC
Any comments on this? Is it being researched?
RP
Ramesh Praveen
Syncfusion Team
March 20, 2003 07:38 PM UTC
David,
Thanks for the sample, we can reproduce the issue. We will fix this bug in our next release.
There doesn't seem to be any easy workaround for this issue. If you do need a workaround before the end of this month, please let us know.
Regards,
Praveen Ramesh
PS
Prakash S
Syncfusion Team
May 8, 2003 08:46 PM UTC
David,
I am reposting my response in Direct-Trac here for the benefit of others that may be interested...
This problem was very recently fixed. Our next public patch will include the fix for this issue. The attached sample does not appear to implement the suggested disposal technique from within the Application.Idle event handler has not been implemented. The following code fragment shows an implementation for disposing off the hidden windows,
// ArrayList to keep track of hidden docking windows to be disposed later
private ArrayList alDisposed = new ArrayList();
private void dockingManager1_DockVisibilityChanged(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs arg)
{
if(this.alDisposed.Contains(arg.Control) == false)
this.alDisposed.Add(arg.Control);
}
// Dispose off the closed docking windows from within the Application.Idle event handler
private void Application_Idle(object sender,EventArgs e)
{
int ncontrols = this.alDisposed.Count;
if(ncontrols > 0)
{
Control[] ctrlstodispose = (Control[]) this.alDisposed.ToArray(typeof(Control));
this.alDisposed.Clear();
for(int i=0; i
AD
Administrator
Syncfusion Team
November 25, 2005 09:14 AM UTC
>I am using version 1.5.2.0
>
>I add the floating window to the docking system as follows (sorry about formatting):
>
>private void label1_Click(object sender, System.EventArgs e) {
> TreeView tvNew=new TreeView();
> Controls.Add(tvNew);
> dockingManager1.FloatControl(tvNew,new Rectangle(Bounds.Left+50,Bounds.Top+50,Bounds.Width-100,Bounds.Height-100));
> dockingManager1.SetDockLabel(tvNew,"Test!");
> dockingManager1.SetCloseButtonVisibility(tvNew,true);
> }
>
>When the user clicks the close button, I want to destroy the window. I''m not sure how to handle this. My first approach was as follows:
>
>private void dockingManager1_DockVisibilityChanged(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangedEventArgs arg) {
> dockingManager1.SetEnableDocking(arg.Control,false);
> arg.Control.Dispose();
> Controls.Remove(arg.Control);
> }
>
>The SetEnableDocking() call will always throw an exception. In a previous thread on this newsgroup, a SyncFusion employee suggested that I execute this cleanup code at Idle time instead of in the VisibilityChanged handler. I tried this, but with the same result. Please tell me how to dispose of a floating control. If possible, I''d like to do this with version 1.5.2.0 instead of upgrading or waiting for a patch. If I upgrade, I know I''ll have a debugging nightmare on my hands since most 3rd party components aren''t fully backward compatible.
>
>David
VS
Vijayanand S
Syncfusion Team
November 30, 2005 06:30 AM UTC
Hi ,
Sorry for the delayed response.
I was able to see the issue. You can replace the following code and create a new Syncfusion.Tools dll. It will solve the problem easily rather than giving workaround for this issue.
DockingMgr.cs file SetEnableDocking method Line No:3620
// If the controller is floating, then redock it to the parent form
if(dhc.Floating == true && (dhc.DockVisibility == true))
dhc.TransitToPrevDock();
However I have attached the modified dll. Please let me know if this helps you.
Thanks for using Syncfusion products.
Regards,
Vijay
Syncfusion.Tools.zip