Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Docking pan reload problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Docking pan reload problem

 Post Reply Post Reply
Author
Message
Cedric Caron View Drop Down
Newbie
Newbie


Joined: 29 July 2006
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric Caron Quote  Post ReplyReply Direct Link To This Post Topic: Docking pan reload problem
    Posted: 18 August 2006 at 8:54pm
I use the folowing code inmy application to create 2 docking pane:
 
 // Create docking panes.
 m_outlookViewBar.Create(this);
 m_pOutlookPan = m_paneManager.CreatePane(IDR_OUTLOOKPAN, CRect(0, 0,200, 120), xtpPaneDockLeft);
 m_pOutlookPan->Attach(&m_outlookViewBar);
 m_nutritionBar.Create(this);
 m_pNutritionPan = m_paneManager.CreatePane(IDR_NUTRITIONPAN, CRect(0, 0,200, 120), xtpPaneDockBottom, m_pOutlookPan);
 m_pNutritionPan->Attach(&m_nutritionBar);
 m_paneManager.AttachPane(m_pNutritionPan, m_pOutlookPan);
 m_paneManager.ShowPane(m_pOutlookPan);
 // Load the previous state for docking panes.
 CXTPDockingPaneLayout layoutNormal(&m_paneManager);
 if(layoutNormal.Load(_T("NormalLayout")))
 {
  m_paneManager.SetLayout(&layoutNormal);
 }
 
And this code to show/hide each pane from a menu
 
void CMainFrame::OnViewWorkspace()
{
 // Toggle the workspace window
 if(m_pOutlookPan->IsClosed())
 {
  m_paneManager.ShowPane(m_pOutlookPan);
 }
 else
 {
  m_paneManager.ClosePane(m_pOutlookPan);
 }
}
void CMainFrame::OnUpdateViewWorkspace(CCmdUI* pCmdUI)
{
 pCmdUI->SetCheck(!m_pOutlookPan->IsClosed());
}
 
and this code to save the positions
 
 // Save the current state for docking panes.
 CXTPDockingPaneLayout layoutNormal(&m_paneManager);
 m_paneManager.GetLayout(&layoutNormal);
 layoutNormal.Save(_T("NormalLayout"));
everything is working fine if I close my application with the first pane in front but if I close close my application with the 2nd pane in front the menu item of the 2nd pan is not checked and my application crash if I select this menu item.
 
The pane is the curnt visible pan but the function m_pOutlookPan->IsClosed() return TRUE and the application crash when I call m_paneManager.ShowPane(m_pOutlookPan) or  m_paneManager.ClosePane(m_pOutlookPan)
 
Everything is working fine if I remove the save/load code
 
Any idea where can be the problem ?
Thanks
 
Cédric
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 18 August 2006 at 10:09pm
Hi,
 
m_pOutlookPan pointer will not be valid after SetLayout call... So use FindPane instead and not save pointers as member.
 
also... better use Notify handler to atach panes. (m_pNutritionPan->Attach(&m_nutritionBar));
 
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cedric Caron View Drop Down
Newbie
Newbie


Joined: 29 July 2006
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cedric Caron Quote  Post ReplyReply Direct Link To This Post Posted: 20 August 2006 at 7:47pm

Thanks for your help everything now working fine.

The notification handle is implemented (without the pann are not displayed) but the 2 windows inside the pan need to be created to allow my application to work properly.
 
When creating the 2 windows inside the notofication the windows is only created when the pane is visible.
 
Congratulation for your very goot toolkit.
 
Cédric 
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.203 seconds.