Print Page | Close Window

Post-Initialization Event?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1771
Printed Date: 17 November 2024 at 11:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Post-Initialization Event?
Posted By: blazej
Subject: Post-Initialization Event?
Date Posted: 09 February 2005 at 4:35pm
Hi

I use both DockingPaneManager and ControlBars. I need to perform some tasks once *all* panes are loaded (they are interdependent). I tried to put my initialization code at the end of MainForm_Load() but it seems that the panes are not attached to the DockingManager at this point. I tried raising an event from within DockingPaneManager_AttachPaneEvent() but got a weird ActiveX error.

Any ideas, anyone?

Thanks

Michal Blazejczyk



Replies:
Posted By: Boyd
Date Posted: 09 February 2005 at 5:54pm

I handle dockable panes like this.  Each "pane" is a separate UserControl.  I have variables declared in the main form that are instances of each pane to create.  I then use the OnLoad override of the form the setup the panes (I use this instead of the forms constructor just to make sure the form is fully loaded).  Within the setup code, I set my variables to a new instance of each UserControl (which will load each one as it's created).  I then create and add my panes to DockingPaneManager.

You shouldn't have to worry about the AttachPane event.  All it does it tell DockingPaneManager the handles of the controls it needs to capture in order to make the pane.  It has nothing to do with the actual loading of the panes (as far as I know).

Your panes will be loaded in the order they are instatiated.  I like to use separate UserControls for each pane because it keeps the code with the pane and makes it easier to use the same pane in another application.

I'm not sure I answered you question, but I hope I helped provide some useful information.  I've never gotten a lot of feedback about C# issues on this forum, so I'll help you were I can.



Posted By: JamesH
Date Posted: 09 February 2005 at 6:34pm

Originally posted by Boyd Boyd wrote:

You shouldn't have to worry about the AttachPane event.  All it does it tell DockingPaneManager the handles of the controls it needs to capture in order to make the pane.  It has nothing to do with the actual loading of the panes (as far as I know).

I'm still quite new to all this, but I found if I setup all my panes in an initialization routine by manually assigning the hwnd handle this worked fine.  UNTIL I tried to load a saved configuration, the load routine seems to re-create all the existing panes so either you need to also assign the handles manually after a load or rely on the AttachPane event as it is called after the load as well as when the panes are first created.  (At least I think that's how it all works, )

As for the original question.  What do you mean by "Loaded"?  Can't you just do it after all of your calls to CreatePane?  If you need to know how many panes have been created so far you could use the count property.  Maybe I'm not following what you want to do...



Posted By: blazej
Date Posted: 10 February 2005 at 11:09am
Thanks, guys. I got a bit confused by CodeJock samples where they create the actual controls only in AttachPane event handlers. Now I'm creating them in MainForm_Load() and it works fine.

There is one question: is it *guaranteed* that the AttachPane events will be raised after MainForm_Load() finishes executing?

Thanks

Michal


Posted By: SuperMario
Date Posted: 10 February 2005 at 11:12am
AttachPane is called when the pane becomes visible.  If a pane is hidden on startup, then the AttachPane for that pane will not be called until it is shown.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net