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.

Exception when docking controls in batch between BeginInit / EndInit

Thread ID:

Created:

Updated:

Platform:

Replies:

68414 Sep 20,2007 02:18 PM Jan 17,2008 06:27 AM Windows Forms 7
loading
Tags: Tools
Andrey Kozyrev
Asked On September 20, 2007 02:18 PM

That actually comes from:
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=68347

Sample is attached.

1) run it
2) press "No Begin/EndInit()" button
3) play with the docked windows like drag&drop, tabs selection etc
--- works fine

1) run it
2) press "Begin/EndInit()" button
3) play with the docked windows like drag&drop, tabs selection etc
--- exception

The code in the first use case is:
this.dockMgr.DockControl(this.red, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 200);
this.dockMgr.DockControl(this.blue, this.red, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, 200); this.dockMgr.DockControl(this.black, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Left, 150);
this.dockMgr.DockControl(this.green, this.black, Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed, 150);

The code in the second use case is:
this.dockMgr.BeginInit();
this.dockMgr.DockControl(this.red, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 200); this.dockMgr.DockControl(this.blue, this.red, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, 200); this.dockMgr.DockControl(this.black, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Left, 150); this.dockMgr.DockControl(this.green, this.black, Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed, 150);
this.dockMgr.EndInit();

VS2005, SyncFusion 5.2.0.25

SyncFusionPOC.zip

Administrator [Syncfusion]
Replied On September 24, 2007 09:36 AM

Hi Andrey,

Thanks for providing the details along with a sample. Please try initializing DockingManager component in MainForm.CS file instead of MainForm.Designer.CS

The following code demonstrates the initialization of DockingManager component.

[C#]

// Create an instance for Docking Manager
private Syncfusion.Windows.Forms.Tools.DockingManager dockMgr;
this.dockMgr = new Syncfusion.Windows.Forms.Tools.DockingManager(this.components);

// Caption settings
this.dockMgr.ActiveCaptionFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);

this.dockMgr.InActiveCaptionFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);

// HostControl
this.dockMgr.HostControl = this;

// Adding CaptionButtons
this.dockMgr.CaptionButtons.Add(new Syncfusion.Windows.Forms.Tools.CaptionButton(Syncfusion.Windows.Forms.Tools.CaptionButtonType.Close, "CloseButton"));
this.dockMgr.CaptionButtons.Add(new Syncfusion.Windows.Forms.Tools.CaptionButton(Syncfusion.Windows.Forms.Tools.CaptionButtonType.Pin, "PinButton"));
this.dockMgr.CaptionButtons.Add(new Syncfusion.Windows.Forms.Tools.CaptionButton(Syncfusion.Windows.Forms.Tools.CaptionButtonType.Menu, "MenuButton"));
this.dockMgr.CaptionButtons.Add(new Syncfusion.Windows.Forms.Tools.CaptionButton(Syncfusion.Windows.Forms.Tools.CaptionButtonType.Maximize, "MaximizeButton"));
this.dockMgr.CaptionButtons.Add(new Syncfusion.Windows.Forms.Tools.CaptionButton(Syncfusion.Windows.Forms.Tools.CaptionButtonType.Restore, "RestoreButton"));

You can also use CodeSnippet option for including the above.

Please refer modified sample and let us know if you have any other queries.

http://websamples.syncfusion.com/samples/Tools.Windows/P68414/main.htm

Regards,
Jaya

Andrey Kozyrev
Replied On September 25, 2007 02:52 PM

Hi Jaya,

Thanks for the reply - exception is gone!

Thanks,
Andrey

Administrator [Syncfusion]
Replied On September 25, 2007 11:22 PM


Hi Andrey,

Thanks for the update.

Kindly let us know if you have any other issues.

Regards,
Jaya

Dave Schmid
Replied On January 9, 2008 06:03 PM

I think I am having this same problem, I get spurious exceptions only when I use BeginInit/EndInit. My app architecture is a bit non-standard, so I am not sure how to apply the advice given in the solution. Can you be more specific about what went wrong in the original code, and why moving the code fixed the issue? E.g., was the problem caused be being inside the SuspendLayout/ResumeLayout? Was it an ordering thing, where something had to be set before something else?

Any more information would be appreciated

Thanks




Administrator [Syncfusion]
Replied On January 10, 2008 01:27 PM

Hi DrProton,

Thank you for your interest in Syncfusion products.

Exception when docking controls between BeginInit() and EndInit()

You can also resolve this exception without initializing the DockingManager in MainForm.cs file.

Please refer the modified sample in which I have intialized UserControl in toolStripButton1_Click instead of MainForm contructor without moving the code of DockingManager initialization from Designer.cs to MainForm.cs.

Sample reference
http://websamples.syncfusion.com/samples/Tools.Windows/F68414/main.htm

Please let me know if you have any further issues.

Regards,
Jaya


Dave Schmid
Replied On January 10, 2008 02:23 PM

Thanks for the response, but I think that your sample code nicely illustrates the problem that I'm having.

If I run your app and press the Begin/EndInit button, it comes up, but as soon as I grab a docking window title bar to start a drag, it throws an exception.

If I press the No Begin/EndInit button, it crashes immediately.





Administrator [Syncfusion]
Replied On January 17, 2008 06:27 AM

Hi DrProton,

Sorry for the delay in getting back to you.

On further analysis of this issue, we have found that docking operations should not be done while docking manager is being initialized i.e. within BeginInit and EndInit statements. Please dock the controls outside the BeginInit and EndInit statement.

Sample reference

Please refer the modified sample in the below location and let me know if you still face any issues.

http://websamples.syncfusion.com/samples/Tools.Windows/F68414/main.htm

Thanks for your patience.

Regards,
Jaya



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.

;