Print Page | Close Window

Can I Use a CView class in the function AttachView

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=11628
Printed Date: 13 May 2025 at 1:57pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Can I Use a CView class in the function AttachView
Posted By: fireflame
Subject: Can I Use a CView class in the function AttachView
Date Posted: 29 July 2008 at 4:28am
The code is following:
LRESULT CEventBrowserView::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
 if (wParam == XTP_DPN_SHOWWINDOW)
 {
  CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
  if((!pPane->IsValid()) && (pPane->GetID() == ID_DOCK))
  {
   if(!m_pOptionView)
    m_pOptionView = DYNAMIC_DOWNCAST(CEventBrowserOptionView,
     pPane->AttachView(this, RUNTIME_CLASS(CEventBrowserOptionView)));
   if(m_pOptionView->GetSafeHwnd())
   {
    pPane->SetTitle(_T("事件列表查询选项"));
    pPane->SetMaxTrackSize(CSize(0,60));
   }
  }
 }
 return TRUE;
}
 
the CEventBrowserOptionView is inherited from CView,while i run it in degbug mode everything is ok,but while i'm using release mode,there'll be an error happened when i close the CEventBrowserView.
 
Is there any special requirements for the CEventBrowserOptionView?
HELP!!!! please



Replies:
Posted By: mgampi
Date Posted: 29 July 2008 at 9:20am
Hi;

Have you tried to overload CView::PostNcDestroy(). The default implementation calls  delete this;
Perhaps the view object will be deleted twice, because panes are derived from CCmdTarget and InternalRelease() will be called -> CCmdTarget::OnFinalRelease() also calls delete this!



-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



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