Print Page | Close Window

Default Docking Idea

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=9270
Printed Date: 16 June 2024 at 8:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Default Docking Idea
Posted By: jemery
Subject: Default Docking Idea
Date Posted: 09 January 2008 at 6:25pm
Just came up with one of those 'duh' moments I thought I'd share.

Not sure how other people have their docking systems set up, but I create a default docking pane setup using the manual pane code first.  Then I do a check to see if a configuration exists in the registry and load that.  This overrides the manual pane setup, naturally.

However, I find that users sometimes manage to totally screw up their pane setups and this doesn't provide for a good way over overriding this.  Since I already was allowing them to save docking configurations (an earlier request as teams like to share configs for different projects), I created an extra config file automatically saved before loading from the registry.  This allows for a default config file that can never go out of date (as it's automatically generated).  So, it's a simple matter for a user to reload to a default window state by loading that file.

Problem solved. :)



Replies:
Posted By: Aaron
Date Posted: 30 January 2008 at 5:58am
Jemery,
 
First of all I am pretty new with DockingPanes. This is what I do:
1) Create the panes and attach them to form.hwnd. (when the app runs for the first time there's nothing in the registry)
2) Use the DockingPaneManager_AttachPane event to attach the panes to the forms. (simular to the CreatePanes function).
 
The first time the app runs, the panes will be positioned like I wanted in the CreatePanes function. On shutdown the positions will be saved with DockingPaneManager.SaveState function. When starting the app again the registry will be filled with the settings saved the last time the app was running. Now to get these settings I use the DockingPaneManager.LoadState function. So now all the code in the CreatePanes function doesn't do anything anymore because the DockingPaneManager.LoadState overrides that. Now the DockingPaneManager_AttachPane event will attach the pane to the form.
 
This will work because the user will position the panes to their own needs. BUT: I'm still working on my project and create a pane that I want to add to my main window. This pane doesn't exist in the registry so the pane will not be visible, I don't know why, but it doesn't. This is what I do: don't call Loadstate, then all the panes will be created and shown. Position the panes like I want to and shut the app. SaveState function will save the settings and voila. Next time the panes are positioned with LoadState function.
 
I don't know if this is the right approach.
Maybe you have a better solution for me, please let me know
 
Thank you in advance  



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