?
Solved

layout of a splitter window

Posted on 1998-12-29
2
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
migel earned 80 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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: 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…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 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