Solved

How to embed a CSplitterWnd in a CDialog

Posted on 1997-11-04
2
1,453 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

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

19 Experts available now in Live!

Get 1:1 Help Now