Solved

How to embed a CSplitterWnd in a CDialog

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

Technology Partners: 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

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: 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.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

696 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