Solved

layout of a splitter window

Posted on 1998-12-29
2
269 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
conditional code and condition difference 9 84
Sed question 2 103
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 104
Is there a simple front-end menu system. 9 105
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.

828 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