Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Destroy pane on closing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Destroy pane on closing

 Post Reply Post Reply
Author
Message
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Topic: Destroy pane on closing
    Posted: 14 August 2006 at 4:24am
I would like to destroy a pane if the user closes it. So far I had no success:
 
LRESULT CMainFrame::OnDockingPaneNotify (WPARAM wParam, LPARAM lParam)
{
   CXTPDockingPane *pPane = (CXTPDockingPane *) lParam;
 
   switch (wParam)
   {
   case XTP_DPN_CLOSEPANE:
      m_paneManager.DestroyPane (pPane);
      1) break;
      2) return XTP_ACTION_NOCLOSE;
   }
 
   return 0;
}
 
1) Causes a crash because the toolkit trys to close a destroyed pane after the event handler returns.
 
2) The pane is beeing destroyed and the toolkit doesn't try to close the pane anymore, but the pane isn't really destroyed. I've attached a view (AttachView) to the pane which isn't destroyed when calling DestroyPane. The view will be destroyed when the main frame is beeing closed.
 
In AttachView I can pass the parent window, but unfortunately I can not set the pane as the parent: cannot convert parameter 1 from 'class CXTPDockingPane *' to 'class CWnd *'
 
 
Codejock support
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: 14 August 2006 at 7:48am
Hi,
You need XTP_ACTION_NOCLOSE + manually destroy child pane.
 
Something like:
 
if (pPane->GetChild()) pPane->GetChild()->DestroyWindow();
m_paneManager.DestroyPane (pPane);
return XTP_ACTION_NOCLOSE;
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2006 at 8:27am
Thanks, pPane->GetChild()->DestroyWindow(); works. But the expected behaviour is if you destroy a window it's childs are destroyed too, which is not the case for the panes.
Codejock support
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: 14 August 2006 at 9:30am
Hi,
 
It is not expected behavior for panes.
For example if developer want to change layout he can destroy pane and create it again and it will not destory child. Or like in panes sample want to change from some "debug" to "Edit" layout.
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.172 seconds.