Solved

3-way splitters in Visual C++

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 104
How to print into std::string like sprintf using C++11? 12 123
HTTPSendRequest with WinINet delays on first call 11 84
How do i run a c++ file? 15 52
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

730 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