Post-Initialization Event? |
Post Reply |
Author | |
blazej
Groupie Joined: 09 February 2005 Location: Canada Status: Offline Points: 53 |
Post Options
Thanks(0)
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 |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
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. |
|
JamesH
Senior Member Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
|
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... |
|
blazej
Groupie Joined: 09 February 2005 Location: Canada Status: Offline Points: 53 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |