Solved

3-way splitters in Visual C++

Posted on 1997-12-15
1
418 Views
Last Modified: 2010-04-10
Hi,

I would like to know if it is possible at all to convert an
existing 2-way splitter SDI App (i.e., explorer look) to a
new 3-way splitter involving 3 different views. This is to
be implemented in Visual C++ 5.0. The 3 desired views may
be : 1 tree view, 1 list view and 1 form view. Thanks.
0
Comment
Question by:baig
[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
1 Comment
 

Accepted Solution

by:
jlilley earned 70 total points
ID: 1176340
Override CMainFrame::OnCreateClient() using the Class Wizard.  Then fill in the body.  This example creates a splitter with two panes on the left, one pane on the right.  The stuff that goes in each pane is an arbitrary view...  You can make each one a tree view, list view, etc.  I've called it "YourView" in this example.

First of all, you need some members in your CMainFrame class to hold this data, so this goe sin your CMainFrm.h:
CSplitterWnd top_splitter;  // splits into two columns
CSplitterWnd left_splitter; // splits left column into two rows
CView* top_left_view;
CView* bottom_left_view;
CView* right_view;

... then this is the overridden method:

BOOL CMainFrame::OnCreateClient(
   LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
   SIZE sz = { 200, 200 };
   // Create the splitter window with two columns
   top_splitter.CreateStatic(this, 1, 2);
   // Create another splitter in the left column
   left_splitter.CreateStatic(
      &top_splitter,     // parent is the first splitter
      2, 1,              // new splitter is 2 rows, 1 column
      WS_CHILD | WS_VISIBLE | WS_BORDER,  // style
      top_splitter.IdFromRowCol(0, 0)
   );

   // Create the top left view
   left_splitter.CreateView(
      0, 0, RUNTIME_CLASS(YourViewClass), sz, pContext
   );
   top_left_view = left_splitter.GetPane(0,0);

   // Create the bottom left view
   left_splitter.CreateView(
      1, 0, RUNTIME_CLASS(YourView), sz, pContext
   );
   bottom_left_view = left_splitter.GetPane(1,0);

   // Create the right view
   top_splitter.CreateView(
      0, 1, RUNTIME_CLASS(YourView), sz, pContext
   );
   right_view = top_splitter.GetPane(0,1);

   // Adjust layout to be reasonable
   top_splitter.SetColumnInfo(0, 200, 100);

   return TRUE;
}

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

688 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