Print Page | Close Window

Attaching CFormView to dockpane problems!

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=1169
Printed Date: 27 September 2024 at 4:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Attaching CFormView to dockpane problems!
Posted By: xred
Subject: Attaching CFormView to dockpane problems!
Date Posted: 13 September 2004 at 3:41am

I want to attach CFormView to a dockpane,the below are the codes:

//////////////////////////////////////////////////////////// ////////////////////////////////////////

LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
 if (wParam == XTP_DPN_SHOWWINDOW)
  {
   // get a pointer to the docking pane being shown.
   CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
   if (!pPane->IsValid())
   {
    switch( pPane->GetID() )
    {
    case 1:
     if (m_wnd.GetSafeHwnd() == 0)
                     {
                          m_wnd.Create(WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE, CRect(0, 0, 0, 0), this, 0);         &am p;am p;nb sp;
                     }
                     pPane->Attach(&m_wnd);
                     break;
    case 2:
     {
      CFrameWnd* pFrame = new CFrameWnd;
      CCreateContext context;    
      context.m_pNewViewClass = RUNTIME_CLASS(CSetLineView);
      context.m_pCurrentDoc = GetActiveView()->GetDocument();

      pFrame->Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, NULL, 0, &context);
      pFrame->ModifyStyleEx (WS_EX_CLIENTEDGE, 0);
      pFrame->SendMessageTo Descendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE);
      pPane->Attach(pFrame) ; 
     }
     break;
    }
   }
  
   return TRUE; // handled
  }
  return FALSE;
}

//////////////////////////////////////////////////////////// //////////////////////////////////////// /////

CSetLineView inherits from CFormView,however it generates an assert!




Replies:
Posted By: xred
Date Posted: 14 September 2004 at 5:41am

Anybody do me a favor?



Posted By: leolea
Date Posted: 15 September 2004 at 5:12am
try the simple way:

 case 2:
     {
        pPane.AttachView(this,RUNTIME_CLASS(CMenuForm),0);
       break;
     }




Posted By: xred
Date Posted: 17 September 2004 at 9:53pm

Aha,I found why it didn't work!

The reason was that I didn't set the dialog's style to "Child"!

leolea,thank you all the same!




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