Solved

layout of a splitter window

Posted on 1998-12-29
2
267 Views
Last Modified: 2013-11-20
Hi,
 I can only create splitter window with a "Grid" style, i.e. 3x3, 2x4, and so on. And I do not know how to create a splitter window with different number of columns for each row. For example, there are three panes. One is on the top. The other two are in the second row. Can anybody tell me how to do this?

wyldsj
0
Comment
Question by:wyldsj
2 Comments
 
LVL 12

Accepted Solution

by:
migel earned 20 total points
ID: 1326985
Hi! It`s simple just create second splitter as child of the first (horz) spliter.
for example:

class C3SplitterFrame : public CMDIChildWnd
{
      DECLARE_DYNCREATE(C3SplitterFrame)
protected:
      C3SplitterFrame();   // protected constructor used by dynamic creation

// Attributes
protected:
      CSplitterWnd m_wndSplitter;
      CSplitterWnd m_wndSplitter2;        // embedded in the first

// Implementation
public:
      virtual ~C3SplitterFrame();
      virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);

      // Generated message map functions
      //{{AFX_MSG(C3SplitterFrame)
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

BOOL C3SplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs,
       CCreateContext* pContext)
{
      // create a splitter with 1 row, 2 columns
      if (!m_wndSplitter.CreateStatic(this, 1, 2))
      {
            TRACE("Failed to CreateStaticSplitter\n");
            return FALSE;
      }

      // add the first splitter pane - the default view in column 0
      if (!m_wndSplitter.CreateView(0, 0,
            pContext->m_pNewViewClass, CSize(200, 50), pContext))
      {
            TRACE("Failed to create first pane\n");
            return FALSE;
      }

      // add the second splitter pane - which is a nested splitter with 2 rows
      if (!m_wndSplitter2.CreateStatic(
            &m_wndSplitter,     // our parent window is the first splitter
            2, 1,               // the new splitter is 2 rows, 1 column
            WS_CHILD | WS_VISIBLE | WS_BORDER,  // style, WS_BORDER is needed
            m_wndSplitter.IdFromRowCol(0, 1)
                  // new splitter is in the first row, 2nd column of first splitter
         ))
      {
            TRACE("Failed to create nested splitter\n");
            return FALSE;
      }

      // now create the two views inside the nested splitter
      int cyText = max(lpcs->cy - 70, 20);    // height of text pane

      if (!m_wndSplitter2.CreateView(0, 0,
            RUNTIME_CLASS(...), CSize(0, cyText), pContext))
      {
            TRACE("Failed to create second pane\n");
            return FALSE;
      }
      if (!m_wndSplitter2.CreateView(1, 0,
            RUNTIME_CLASS(...), CSize(0, 0), pContext))
      {
            TRACE("Failed to create third pane\n");
            return FALSE;
      }

      // it all worked, we now have two splitter windows which contain
      //  three different views
      return TRUE;
}

just replace RUNTIME_CLASS(...) to the yours.

0
 

Author Comment

by:wyldsj
ID: 1326986
Got it! Thanks!!!

wyldsj
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 90
windows 10 how make picture as desktop background 2 62
Unix Command -- Challenging  question 7 88
x-bar in Google Sheets 2 50
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

813 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

10 Experts available now in Live!

Get 1:1 Help Now