?
Solved

How to embed a CSplitterWnd in a CDialog

Posted on 1997-11-04
2
Medium Priority
?
1,544 Views
Last Modified: 2013-11-20
How to embed a CSplitterWnd in a CDialog
0
Comment
Question by:larsjohansson
[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
2 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 800 total points
ID: 1309313
a) Derive class from CSplitterWnd
b) Use this class in your dialog box.
c) Use the OnMouseActivate()(handles WM_MOUSEACTIVATE) to find out if mouse is on top of one of panes and set active pane otherwise let MFC handle the task.
d) Overide virtual function SetActivePane() to set active pane
void CDerivedSplitterWnd::SetActivePane(int row, int col, CWnd* pWnd)
{
// get pane to set active
CWnd* pPane = ((pWnd == NULL) ? GetPane(row, col) : pWnd);
// set focus to specified pane
pPane->SetFocus();
}
e) In the header of your dialog add
CDerivedSplitterWnd *m_pSplitterWnd;
and initialize it to NULL in constructor, then in OnInitDialog()
create object type of CDerivedSplitterWnd, create splitter window as static or dynamic and do not forget to show it(by defaul it created invisible)
f) delete object in destractor

There is one more way of doing is create object derived from CFrameWnd inside your dialog and then use it to implement splitter window the way AppWizard does using OnCreateClient()...
0
 

Author Comment

by:larsjohansson
ID: 1309314
Excellent answer worth 200 pts.
The 'best' way (if you want to follow the MFC rules) must be to create a CFrameWnd inside the Dialog.

Why didn't this obvious solution came to me in the first place...

Thank you mr. gelbert, this saved me a couple of hours.


0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

762 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