CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2012
    Posts
    20

    MFC Splitter window - failed to create empty document

    I am trying to put a view class into each splitter window.

    I have a problem with using m_leftClass. I want to use m_leftClass so I can attach it to a separate ViewClass and RichEditCtrl class. The problem is I get "Failed to create empty document" message box error.

    If I use pContext->m_pNewViewClass instead of m_leftClass., I don't get the error, but I don't know how to use pContext->m_pNewViewClass object with RichEditCtrl.



    Here is my code:

    Code:
    m_leftClass  = RUNTIME_CLASS(CView);
    	m_rightClass = RUNTIME_CLASS(CRConsole);
    
    	// create a splitter with 1 row, 2 columns
    	if (!m_wndSplitter.CreateStatic
    		(this, 1, 2, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST))
    		//(this, 1, 2))
    	{
    		TRACE0("Failed to CreateStaticSplitter\n");
    		return FALSE;
    	}
    
    	//for sizing of split windows
    	CRect rc;
    	GetClientRect(&rc);
    
    	//pContext->m_pNewViewClass
    
    	// add the first splitter pane - the default view in column 0
    	if (!m_wndSplitter.CreateView(0, 0,
    		m_leftClass, CSize(rc.Width()/2,rc.Height()), pContext))//m_left class not being used
    	{
    		TRACE0("Failed to create first pane\n");
    		return FALSE;
    	}
    
    	// add the second splitter pane - an input view in column 1
    	if (!m_wndSplitter.CreateView(0, 1,
    		m_rightClass, CSize(0, 0), pContext))
    	{
    		TRACE0("Failed to create first pane\n");
    		return FALSE;
    	}

  2. #2
    Join Date
    Mar 2012
    Posts
    20

    Re: MFC Splitter window - failed to create empty document

    I guess my question is:

    What is this object pContext->m_pNewViewClass and what is it placing in the left splitter window?

  3. #3
    Join Date
    Mar 2012
    Posts
    20

    Re: MFC Splitter window - failed to create empty document

    I guess my question is:

    What is this object pContext->m_pNewViewClass and what is it placing in the left splitter window?

  4. #4
    Join Date
    Mar 2012
    Posts
    20

    Re: MFC Splitter window - failed to create empty document

    I think I figured it out from trial and error. Its putting the CMyView class into the left splitter window when I use pContext->m_pNewViewClass. I then can control CMyView class through the OnCreate() or InitUpdate() overides.

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