Solved

CSplitterWnd question

Posted on 1997-12-11
7
448 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 156
Folder Comparison 12 52
Doc'in system (example?) BA 7 79
zeroFront challenge 7 71
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

11 Experts available now in Live!

Get 1:1 Help Now