Solved

How to embed a CSplitterWnd in a CDialog

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

Suggested Solutions

Title # Comments Views Activity
how to monitor remote shell execution on linux 9 112
isEverywhere  challenge 19 90
noX challenge 17 143
Windows shortcut location resolution on double click open 4 74
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…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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