Solved

3-way splitters in Visual C++

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Would like to move button in a function 3 71
How to copy an image file into clipboard C/C++? 1 151
C++ question 3 61
Header of docx file 17 97
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

919 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

23 Experts available now in Live!

Get 1:1 Help Now