Solved

layout of a splitter window

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maven archtype selection in eclipse 1 51
Smart Camera scanning and reading information 3 86
scoreUp challenge 14 48
Problem to event 3 50
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

20 Experts available now in Live!

Get 1:1 Help Now