Solved

How to embed a CSplitterWnd in a CDialog

Posted on 1997-11-04
2
1,437 Views
Last Modified: 2013-11-20
How to embed a CSplitterWnd in a CDialog
0
Comment
Question by:larsjohansson
2 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 200 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

18 Experts available now in Live!

Get 1:1 Help Now