Solved

3-way splitters in Visual C++

Posted on 1997-12-15
1
402 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 clear a vector as well as how to detect empty vectors in C++.

707 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

14 Experts available now in Live!

Get 1:1 Help Now