Splitter Window and Views

Posted on 2008-11-12
Last Modified: 2013-11-20

I have an SDI MFC application.

I want to add a splitter so I can split the frame into two i.e. a top and bottom.

In the top bit I want to show the existing view (the one created when I created the SDI) and in the bottom bit I want to display a new view.

My question is, how do I create the new view AND how can control what goes on in it?

Question by:IssacJones
    1 Comment
    LVL 30

    Accepted Solution

    Hi IssacJones,

    in general this is done like this:

    - Add a CSplitterWnd-member (i.e. m_wndSplitter) to the CMainFrame class
    - In CMainFrame::OnCreateClient create a static splitter with 'CSplitterWnd::CreateStatic'
    - For each splitter pan you create a view with 'CSplitterWnd::CreateView'

    I'm not exactly sure what you mean with 'control what goes on in it' - if you have multiple views in a splitter window the all belong to the same document. So, if you i.e. need to reflect changes in one view to all views you can use CDocument::UpdateAllViews with overriden CView::OnUpdate. Keyboard and mouse-input alway go to the view in the active pane (see CSplitterWnd::GetActivePane and CSplitterWnd::SetActivePane).

    If you search the web for these functions you can find a lot of samples ...

    Hope that helps,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Title # Comments Views Activity
    How to determine file rename from EventLog ? 2 33
    substring method in java 1 59
    twoTwo  challenge 35 71
    Fibonacci challenge 11 61
    Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    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.
    This video discusses moving either the default database or any database to a new volume.

    759 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

    14 Experts available now in Live!

    Get 1:1 Help Now