Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - AttachView and connect to document
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

AttachView and connect to document

 Post Reply Post Reply
Author
Message
Frank_E View Drop Down
Newbie
Newbie


Joined: 26 February 2009
Location: Germany
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Frank_E Quote  Post ReplyReply Direct Link To This Post Topic: AttachView and connect to document
    Posted: 26 February 2009 at 12:17pm
Hello,

I use your docking pane to display a CFormView based view. The View is attached to the pane with pPane->AttachView(this, RUNTIME_CLASS(CmyViewClass)). So far so good. The View is displayed correctly. But I want this view connected to a document. This view is not in the DocTemplate because it is not the default view. When I follow your example, the view is created and attached dynamically in OnDockingPaneNotify:

LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
    if (wParam == XTP_DPN_SHOWWINDOW)
    {
        CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

        if (!pPane->IsValid())
        {
            switch (pPane->GetID())
            {
            case IDR_PANE_myPane:
                {
                    //CCreateContext does not work here, because at this point there is no document.

                    pPane->AttachView(this, RUNTIME_CLASS(CmyView));

                    break;
                }
            }
        }
        return TRUE;
    }
    return FALSE;
}

The problem is, that at this point no document exist and I can't pass a pointer to the document and its content to AttachView together with the runtime class of  my view. How can I link my dynamically created view to my document?.

regards,
Frank.
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: 27 February 2009 at 3:01am

Hi,

You can create CView in some OnCreateClient method and then attach it in OnDockingPaneNotify.   
But guess its not right to connect pane to Document.
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.063 seconds.