Solved

Splitter Window as MDI (not SDI)

Posted on 1998-09-24
4
1,067 Views
Last Modified: 2013-11-19
Is there a way to do splitter windows in MDI views? I tried
creating the splitters in CMDIChildframe, but ended up with an SDI view. I want to do this as a static splitter.
0
Comment
Question by:bhale
  • 2
  • 2
4 Comments
 

Author Comment

by:bhale
ID: 1322557
Choosing a Split style when starting a new app is not acceptable, because you get the same view split (similar to VC++ source code window). I want two windows (like CListView and CFormView) in one split view.
0
 
LVL 1

Accepted Solution

by:
VAM345 earned 100 total points
ID: 1322558
In you InitInstance create a doc template for you CMyFormView
      CMultiDocTemplate* pSpliterTemplate;
      pSpliterTemplate = new CMultiDocTemplate(
            IDR_SPLITERTYPE,
            RUNTIME_CLASS(CMySplitDoc),
            RUNTIME_CLASS(CMyMDIChildWnd), // custom MDI child frame
            RUNTIME_CLASS(CMyFormView));
      AddDocTemplate(pSpliterTemplate);

BOOL CMyMDIChildWnd::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
{
      if (!m_wndSplitter.CreateStatic(this, 1, 2))
      {
            TRACE0("Failed to CreateStaticSplitter\n");
            return FALSE;
      }

      // add the first splitter pane - the default view in column 0
      if (!m_wndSplitter.CreateView(0, 0,
            RUNTIME_CLASS(CMyListView), CSize(180, 50), pContext))
      {
            TRACE0("Failed to create second pane\n");
            return FALSE;
      }

      // add the second splitter pane - an input view in column 1
      if (!m_wndSplitter.CreateView(0, 1,
            pContext->m_pNewViewClass, CSize(0, 0), pContext))
      {
            TRACE0("Failed to create first pane\n");
            return FALSE;
      }

      // activate the input view
      SetActiveView((CView*)m_wndSplitter.GetPane(0,1));
      
      return TRUE;
}

0
 

Author Comment

by:bhale
ID: 1322559
That's exactly what I needed. The key seems to be to use the pContext->m_pNewViewClass as the CRuntime parameter in CreateView. All I need to do now is resize the components of the CFormView so that the controls (list and tree) fill the panes.
0
 
LVL 1

Expert Comment

by:VAM345
ID: 1322560
I`m very happy to help you.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question