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
|