Solved

CSplitterWnd question

Posted on 1997-12-11
7
457 Views
Last Modified: 2013-11-20
I've got several splitters in different MDI child windows. When the main frame receive WM_CLOSE, I want to save the position of the splitters. I call CSplitterWnd::GetRowInfo to get the current position. That works alright for the active MDI child window, but not the rest. There I get the approx same value whatever the real position is.
Why is that, and how do I fix it?
0
Comment
Question by:rj2
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:MarkusLoibl
ID: 1312143
I have a solution for you, but its too big to sourcecode it here.
Tell me your email and I'll send you!
MLoibl@moss.de
0
 
LVL 1

Expert Comment

by:MarkusLoibl
ID: 1312144
In my solution there is a mechanism to save/reset the pane-positions. I do not use MDIchilds, but use my own abstration of how to describe splitted panes. It's flexible, because one is not limited by any number of panes and can be changed dynamically (its done so e.g. when you restart the program). I cannot and do not want to give you the class-library you are looking for, thats your task. You just asked how to do it. You can do it my way (in my splitter-classes you can retrieve the sizes, because they are stored in the registry).
If you are not happy with it, just reject it, that's noproblem for me.
0
 
LVL 10

Author Comment

by:rj2
ID: 1312145
I asked how to get the correct splitter position from a splitter in non-active mdi child window. The source is probably great, but it don't answer that. I'm neither looking for nor expecting a class library. I just want information on how to solve this particular problem.

0
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!

 
LVL 3

Accepted Solution

by:
altena earned 200 total points
ID: 1312146
The easiest approach is to remember the splitter position
when a MDI object gets deactivated.

All you have to do when the application is closed is to enumerate over your MDI-children and write these
positions to the registry.

Good Luck.
0
 
LVL 10

Author Comment

by:rj2
ID: 1312147
You mean call CSplitterWnd::GetRowInfo and buffer the value in a WM_MDIACTIVATE handler?
You say that's the easiest approach, I'm just curious: what other approaches are there?
Do you know why CSplitterWnd::GetRowInfo gives incorrect results when the mdi child isn't active?
0
 
LVL 3

Expert Comment

by:altena
ID: 1312148
Even simpler:
Call CSplitterWnd::GetRowInfo and buffer the value in a
WM_ACTIVATE handler.
The window to be deactivated will get a
fActive == WA_INACTIVE parameter

I think the above solution is a good one. The best would be
to get CSplitterWnd::GetRowInfo working. (suprise)

However, out of principle, I do not study MFC internals,
Just like you my job is to build software. If I have to learn
the internals of a class library in order to use it, then
thanks, but I will use the Win32 API with straight C/C++.

So when problems (like your question) pop up my first instinct
is to look for another way to archieve the desired result.

  Happy Hollidays



0
 
LVL 10

Author Comment

by:rj2
ID: 1312149
Thanks. Happy holidays to you too.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

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