Print Page | Close Window

Docking pan reload problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=4835
Printed Date: 12 December 2024 at 7:41am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Docking pan reload problem
Posted By: Cedric Caron
Subject: Docking pan reload problem
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: Cedric Caron
Date 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 



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