Print Page | Close Window

CXTPDockingPaneManager Adding Later

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5993
Printed Date: 27 July 2025 at 5:48pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPDockingPaneManager Adding Later
Posted By: danpetitt
Subject: CXTPDockingPaneManager Adding Later
Date Posted: 04 January 2007 at 7:18pm
Hi
 
I have a GUI (DevStudio like) and have docking panes in the application. I am saving the layout of the panes to an XML file.
 
My product is being used at the moment, but I want to add a new pane, if i do none of my users can view it unless they delete the settings.xml file.
 
How do I get my new pane to be added and still maintain the layout and settings of the rest of the app?
 
Basically in MainFrm I:
 CXTPDockingPane *pwndProject = m_paneManager.CreatePane( ID_PANE_PROJECT, CRect(0, 0, 300, 150), xtpPaneDockLeft );
 CXTPDockingPane *pwndEditedFiles = m_paneManager.CreatePane( ID_PANE_EDITED_FILES, CRect(0, 0, 200, 150), xtpPaneDockRight );
 GetDockingPaneManager()->AttachPane( pwndEditedFiles, pwndProject );
...
 
 CXTPPropExchangeXMLNode px( TRUE, 0, _T("Settings") );
 if( px.LoadFromFile( GetAppDataLocation( AfxGetApp()->m_pszRegistryKey, AfxGetApp()->m_pszAppName, _T("Settings.xml") ) ) )
 {
 CXTPPropExchangeSection pxDockingPane(px.GetSection(_T("DockingPane")));
 m_paneManager.DoPropExchange(&pxDockingPane);
}
 
As you can see, I create my panes and then i load up my layout from an existing settings file ... but the settings file knows nothing about this new pane (ID_PANE_EDITED_FILES) so it doesnt get added.
 
I can use m_paneManager.ShowPane( ID_PANE_EDITED_FILES ); to show the pane after loading the layout, but i cant use this all the time as it may be purposefully hidden by the user later on and doing this will keep showing it.
 
I also added a menu command to view the pane but that doesnt appear either.
 
Help, can you give me a solution, thanks.



Replies:
Posted By: Oleg
Date Posted: 05 January 2007 at 1:58am
Hi,
 
Check number of panes after you load layout:
 
m_paneManager.GetPaneList().GetSize() and if it was "1" call m_paneManager.CreatePane again.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: danpetitt
Date Posted: 05 January 2007 at 2:22am
Thanks Oleg
 
Its GetCount (for others reading this post, not GetSize).
 
Thanks a lot for this, I basically added this as per your suggestion and it works great:

// Create my panes
...
 
// Load my layout
....
 
// Check I have the right number of panes, if not, create my new ones
 if( m_paneManager.GetPaneList().GetCount() == 1 )
 {
  CXTPDockingPane *pProjectPane = m_paneManager.FindPane( ID_PANE_PROJECT );
  ASSERT( pProjectPane );
 
 CXTPDockingPane *pwndEditedFiles = m_paneManager.CreatePane( ID_PANE_EDITED_FILES, CRect(0, 0, 200, 150), xtpPaneDockRight );
  m_paneManager.AttachPane( pwndEditedFiles, pProjectPane );
}
 
Thanks again Oleg, you have saved me yet again :-)


Posted By: Oleg
Date Posted: 05 January 2007 at 2:32am
No. GetPaneList().GetCount() must return number of created panes - no metter they was hidden or closed.
 
Don't call AttachPane if you create it after you load layout. Neighbour pane can be closed or hiddne.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 05 January 2007 at 2:34am
.... For future you can add versrion information to px section.
PX_Int(&px, "VersionInfo", m_nVersion, 0);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: danpetitt
Date Posted: 05 January 2007 at 2:38am

Oops, you got in there whilst i was editing/correcting my original post (darn, no nothing makes sense to others) ... sorry.

 
Is this not okay as I want it to appear next to my Project Pane if its there?

  CXTPDockingPane *pProjectPane = m_paneManager.FindPane( ID_PANE_PROJECT );
  ASSERT( pProjectPane );
  CXTPDockingPane *pwndEditedFiles = m_paneManager.CreatePane( ID_PANE_EDITED_FILES, CRect(0, 0, 200, 150), xtpPaneDockRight );
  if( pProjectPane && !pProjectPane->IsHidden() && !pProjectPane->IsClosed() )
   m_paneManager.AttachPane( pwndEditedFiles, pProjectPane );


Posted By: danpetitt
Date Posted: 05 January 2007 at 2:45am
Originally posted by oleg oleg wrote:

No. GetPaneList().GetCount() must return number of created panes - no metter they was hidden or closed.
Thats what I need isnt it, I want to only create the pane if its the total count available ... otherwise they could close it, re open the app and it would re-add it again.


Posted By: Oleg
Date Posted: 05 January 2007 at 8:51am
Yes, think this code must work ok.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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