Print Page | Close Window

AttachView and connect to document

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=13510
Printed Date: 25 April 2024 at 11:47pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: AttachView and connect to document
Posted By: Frank_E
Subject: AttachView and connect to document
Date 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.



Replies:
Posted By: Oleg
Date 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



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