We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Can't dispose of floating control !

Thread ID:

Created:

Updated:

Platform:

Replies:

3315 Mar 12,2003 09:35 AM Nov 30,2005 01:30 AM Windows Forms 9
loading
Tags: Tools
Thomas A. Anderson, Program Writer
Asked On March 12, 2003 09:35 AM

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.

Ramesh Praveen [Syncfusion]
Replied On March 13, 2003 02:18 PM

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

Thomas A. Anderson, Program Writer
Replied On March 13, 2003 03:45 PM

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

Prakash S [Syncfusion]
Replied On March 16, 2003 11:21 PM

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

Thomas A. Anderson, Program Writer
Replied On March 17, 2003 09:15 AM

see attached file for sample that reproduces the error...Or download from this Url: http://temp.codefanatic.com/20030317/DockFrock.zip

Thomas A. Anderson, Program Writer
Replied On March 19, 2003 08:01 AM

Any comments on this? Is it being researched?

Ramesh Praveen [Syncfusion]
Replied On March 20, 2003 02:38 PM

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

Prakash S [Syncfusion]
Replied On May 8, 2003 04:46 PM

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

Administrator [Syncfusion]
Replied On November 25, 2005 04:14 AM

>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

Vijayanand S [Syncfusion]
Replied On November 30, 2005 01:30 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;