CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 1999
    Posts
    1

    MultiDocTemplate

    How do I open a new view without opening a new document. For example, two CFormViews on the same Document.


  2. #2
    Guest

    Re: MultiDocTemplate

    try something like this from a message handler in the document:

    CMDIChildWnd *pActiveChild = ((CMDIFrameWnd*)AfxGetApp()->m_pMainWnd)->MDIGetActive();
    if ( pActiveChild == NULL )
    return;

    CMyTemplate *pTemplate = ((CMyApp *)AfxGetApp())->MyTemplate();
    CRuntimeClass *pOldView = pTemplate->SetView( RUNTIME_CLASS( CAnotherView ) );
    UINT nOldID = pTemplate->SetID( IDR_GRIDVIEW );

    ASSERT_VALID(pTemplate);
    CFrameWnd *pFrame = pTemplate->CreateNewFrame( this, pActiveChild );
    ASSERT( pFrame );
    if ( pFrame == NULL )
    return;

    pTemplate->InitialUpdateFrame( pFrame, this );




  3. #3
    Join Date
    Apr 1999
    Posts
    383

    Re: MultiDocTemplate

    To do it manually, use CDocument::AddView(CView*).

    Otherwise, create another CDocTemplate with the same document but a new view.

    Dave


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured