Solved

Splitter Window as MDI (not SDI)

Posted on 1998-09-24
4
1,041 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now