Solved

3-way splitters in Visual C++

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

803 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