Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Attaching CFormView to dockpane problems!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Attaching CFormView to dockpane problems!

 Post Reply Post Reply
Author
Message
xred View Drop Down
Groupie
Groupie
Avatar

Joined: 24 August 2004
Location: China
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote xred Quote  Post ReplyReply Direct Link To This Post Topic: Attaching CFormView to dockpane problems!
    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!



Edited by xred
Back to Top
xred View Drop Down
Groupie
Groupie
Avatar

Joined: 24 August 2004
Location: China
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote xred Quote  Post ReplyReply Direct Link To This Post Posted: 14 September 2004 at 5:41am

Anybody do me a favor?

Back to Top
leolea View Drop Down
Newbie
Newbie


Joined: 15 September 2004
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote leolea Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2004 at 5:12am
try the simple way:

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




Edited by leolea
Back to Top
xred View Drop Down
Groupie
Groupie
Avatar

Joined: 24 August 2004
Location: China
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote xred Quote  Post ReplyReply Direct Link To This Post 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!

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.184 seconds.