Docking pan reload problem |
Post Reply |
Author | |
Cedric Caron
Newbie Joined: 29 July 2006 Status: Offline Points: 13 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
Cedric Caron
Newbie Joined: 29 July 2006 Status: Offline Points: 13 |
Post Options
Thanks(0)
|
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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |