Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTDockWindow and views
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTDockWindow and views

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


Joined: 13 February 2004
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote bobo Quote  Post ReplyReply Direct Link To This Post Topic: CXTDockWindow and views
    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

Back to Top
ddyer View Drop Down
Groupie
Groupie
Avatar

Joined: 01 December 2003
Location: United States
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddyer Quote  Post ReplyReply Direct Link To This Post 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; 

 ...

}

 



Edited by ddyer
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.203 seconds.