Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPDockingPaneManager Adding Later
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPDockingPaneManager Adding Later

 Post Reply Post Reply
Author
Message
danpetitt View Drop Down
Senior Member
Senior Member


Joined: 17 July 2005
Location: United Kingdom
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote danpetitt Quote  Post ReplyReply Direct Link To This Post Topic: CXTPDockingPaneManager Adding Later
    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.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
danpetitt View Drop Down
Senior Member
Senior Member


Joined: 17 July 2005
Location: United Kingdom
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote danpetitt Quote  Post ReplyReply Direct Link To This Post 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 :-)
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
danpetitt View Drop Down
Senior Member
Senior Member


Joined: 17 July 2005
Location: United Kingdom
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote danpetitt Quote  Post ReplyReply Direct Link To This Post 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 );
Back to Top
danpetitt View Drop Down
Senior Member
Senior Member


Joined: 17 July 2005
Location: United Kingdom
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote danpetitt Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2007 at 8:51am
Yes, think this code must work ok.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.051 seconds.