Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Destroying a pane instead of closing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Destroying a pane instead of closing

 Post Reply Post Reply
Author
Message
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Topic: Destroying a pane instead of closing
    Posted: 22 December 2004 at 2:23pm
Hello,

how can I destroy the pane instead of closing it ?

Of course I know about the method DestroyPane in class
DockingPaneManager...

Assume I want to destroy the pane after the user depressed the pane's close button.

Thanks in advance !

Alex
Back to Top
spike View Drop Down
Groupie
Groupie


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Posted: 22 December 2004 at 9:12pm
Well then you should call DestroyPane in the XTPN_CLOSE_PANE (sp?) notifcation in OnDockingPaneNotify.
Back to Top
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2004 at 5:31am
I tried that of course too. But the pointer to the pane is still in use after the notification :

void CXTPDockingPaneManager::ClosePane(CXTPDockingPane* pPane)
{
     if (pPane == NULL) return;

     if (m_pSite->SendMessage(XTPWM_DOCKINGPANE_NOTIFY, XTP_DPN_CLOSEPANE, (LPARAM)pPane) == XTP_ACTION_NOCLOSE)
           return;
     
     SAFE_CALLPTR(pPane->m_pPare ntContainer, RemovePane(pPane));     
}
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: 23 December 2004 at 7:46am

 you shold destroy it and return XTP_ACTION_NOCLOSE

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2004 at 2:08pm
Thanks for your help !

It works fine this way :

LRESULT FileBrowserFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
..
..
else if ( wParam == XTP_DPN_ACTION )
    {
    XTP_DOCKINGPANE_ACTION *action = XTP_DOCKINGPANE_ACTION*)lParam;

    if ( action->action == xtpPaneActionClosed )
      GetDockingPaneManager()- >DestroyPane( action->pPane );

    return TRUE;
    }
}
Back to Top
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Posted: 23 December 2004 at 2:23pm
This is the optimized way

else if ( wParam == XTP_DPN_ACTION )
    {
    XTP_DOCKINGPANE_ACTION *action = XTP_DOCKINGPANE_ACTION*)lParam;

    action->pPane->Detach();
       
    pFileBrowserTreeView->DestroyWind ow();
    pFileBrowserTreeView = NULL;

    if ( action->action == xtpPaneActionClosed )
      GetDockingPaneManager()- >DestroyPane( action->pPane );

    return TRUE;
    }

Back to Top
spike View Drop Down
Groupie
Groupie


Joined: 13 May 2003
Location: United States
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote spike Quote  Post ReplyReply Direct Link To This Post Posted: 05 January 2005 at 2:34pm

Thats kind of strange that you say the pointer is in use after the Close. This is my code which seems to work fine.

FOREACH_ARRAY( m_arrOptionalPaneID, i )
  {
   CXTPDockingPane *pPane = m_pPaneManager->FindPane( m_arrOptionalPaneID );
   m_pPaneManager->ClosePane( m_arrOptionalPaneID );

   if( pPane )
   {
    m_pPaneManager->DestroyPane( pPane );
   }
  }

Edit: Actually they use  SAFE_PTR call, which probly validates that the pointer. So it should be safe, nevertheless you have your solution.

Originally posted by Alex G. Alex G. wrote:

This is the optimized way

else if ( wParam == XTP_DPN_ACTION )
    {
    XTP_DOCKINGPANE_ACTION *action = XTP_DOCKINGPANE_ACTION*)lParam;

    action->pPane->Detach();
       
    pFileBrowserTreeView->DestroyWind ow();
    pFileBrowserTreeView = NULL;

    if ( action->action == xtpPaneActionClosed )
      GetDockingPaneManager()- >DestroyPane( action->pPane );

    return TRUE;
    }



Edited by spike
Back to Top
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Posted: 06 January 2005 at 2:55am
It's a matter of when you're destroying the pane. Try it if you're processing 'XTPN_CLOSE_PANE' notification - it will fail.
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.