Print Page | Close Window

CXTDockWindow and views

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=442
Printed Date: 23 December 2024 at 12:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTDockWindow and views
Posted By: bobo
Subject: CXTDockWindow and views
Date Posted: 13 February 2004 at 9:14am

Hi!

I'm having trouble getting my CXTDockWindow to work with a view in my SDI application. I'm using the method explained in KB 005.007 to create my frame and view. I'm sharing document between the main view and the view in my docking window. All messages gets routed correctly when the window is docked, but as soon as I "undock" the window it gets silent.

Any ideas?

- Bobo




Replies:
Posted By: ddyer
Date Posted: 16 February 2004 at 11:42am

Hi!  I have an SDI app and have views in panes.  They work whether you open or close the views, etc.   I stole this trick from Oleg.  Below is a function to place in your mainfrm.cpp that creates a panel window based on a particular view.  The view is then created and attached to your document.  It will receive all your doc update messages and whatnot:

 

FrameWnd* CMainFrame::CreateView(CRuntimeClass *type)
{
CFrameWnd *pFrame = new CFrameWnd;
CCreateContext context;
::ZeroMemory(&context, sizeof(context));

context.m_pNewViewClass = type;
context.m_pCurrentDoc = NULL;
context.m_pCurrentFrame = GetParentFrame();

CDocManager *pManager = AfxGetApp()->m_pDocManager;
if (pManager != NULL) {
     POSITION posTemplate = pManager->GetFirstDocTemplatePosition();
     if (posTemplate != NULL) {
        CDocTemplate *pTemplate = pManager->GetNextDocTemplate(posTemplate);
        POSITION posDoc = pTemplate->GetFirstDocPosition();
        if (posDoc != NULL) {
           CccAnalyzeDoc *mydoc = (CccAnalyzeDoc *)pTemplate->GetNextDoc(posDoc);
           context.m_pCurrentDoc = mydoc;
           if (m_doc == NULL)
                m_doc = mydoc;
        }
     }
}

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, SWP_FRAMECHANGED);
pFrame->GetWindow(GW_CHILD)->ModifyStyleEx(WS_EX_CLIEN TEDGE, 0,
     SWP_FRAMECHANGED);

return pFrame;
}

 

Then, to create a view in your "onDockingPaneNotify" routine, just do:

switch (pPane->GetID()) {

 ...

     case IDR_PANE_MYPANE:
        pPane->Attach(CreateView(RUNTIME_CLASS(myViewClass)));
        break; 

 ...

}

 




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