Exception when docking controls in batch between BeginInit / EndInit
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
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
SIGN IN To post a reply.
7 Replies
AD
Administrator
Syncfusion Team
September 24, 2007 01:36 PM UTC
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
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
AK
Andrey Kozyrev
September 25, 2007 06:52 PM UTC
Hi Jaya,
Thanks for the reply - exception is gone!
Thanks,
Andrey
Thanks for the reply - exception is gone!
Thanks,
Andrey
AD
Administrator
Syncfusion Team
September 26, 2007 03:22 AM UTC
Hi Andrey,
Thanks for the update.
Kindly let us know if you have any other issues.
Regards,
Jaya
DS
Dave Schmid
January 9, 2008 11:03 PM UTC
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
Any more information would be appreciated
Thanks
AD
Administrator
Syncfusion Team
January 10, 2008 06:27 PM UTC
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
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
DS
Dave Schmid
January 10, 2008 07:23 PM UTC
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.
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.
AD
Administrator
Syncfusion Team
January 17, 2008 11:27 AM UTC
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
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
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
AK Andrey Kozyrev
- Sep 20, 2007 06:18 PM UTC
- Jan 17, 2008 11:27 AM UTC