resizing a splitter window
jeffg@iqpuucp.aa.iqsc.com
Monday, February 05, 1996
I have a splitter window with 2 views. One of the views holds a
CTreeCtrl. Whenever the child window is resized I get an OnSize
message and manually have to resize the CTreeCtrl. However, whenever
the splitter window is resized, the message doesn't come through the
OnSize. Can someone help me here as I have tried asking in other areas
without getting a response back. Thanks.
Regis VAQUETTE -- vaquette@dr.sncf.fr
Tuesday, February 06, 1996
[Mini-digest: 2 responses]
> I have a splitter window with 2 views. One of the views holds a
> CTreeCtrl. Whenever the child window is resized I get an OnSize
> message and manually have to resize the CTreeCtrl. However, whenever
> the splitter window is resized, the message doesn't come through the
> OnSize. Can someone help me here as I have tried asking in other areas
> without getting a response back. Thanks.
>
Why don't you use a CTreeView rather than a CTreeCtrl ? I think that this type
of View is advised by Microsoft if we want to use it in a spliter wmd.
-----From: Mario Contestabile
[Start()]
I have a splitter window with 2 views. One of the views holds a
CTreeCtrl. Whenever the child window is resized I get an OnSize
message and manually have to resize the CTreeCtrl. However, whenever
the splitter window is resized, the message doesn't come through the
OnSize. Can someone help me here as I have tried asking in other areas
without getting a response back. Thanks.
[Stop()]
Replace the current view class for the tab control with CTreeView.
mcontest@universal.com
jeffg@iqpuucp.aa.iqsc.com
Wednesday, February 07, 1996
[Mini-digest: 3 responses]
I am using a child window with no border. I used the palette which
places a CTreeCtrl on the window and then I use that as my template
for the view.
If I inherit my view from CTreeView, I cannot place any controls on
it. So, right now it is inheriting from CFormView and using the
template method above.
-----From: Mario Contestabile
[Start()]
I have a splitter window with 2 views. One of the views holds a
CTreeCtrl. Whenever the child window is resized I get an OnSize
message and manually have to resize the CTreeCtrl. However, whenever
the splitter window is resized, the message doesn't come through the
OnSize. Can someone help me here as I have tried asking in other areas
without getting a response back. Thanks.
[Stop()]
Replace the current view class for the tab control with CTreeView.
mcontest@universal.com
-----From: "Joseph M. Koral"
> I have a splitter window with 2 views. One of the views holds a
> CTreeCtrl. Whenever the child window is resized I get an OnSize
> message and manually have to resize the CTreeCtrl. However, whenever
> the splitter window is resized, the message doesn't come through the
> OnSize. Can someone help me here as I have tried asking in other areas
> without getting a response back. Thanks.
>> Why don't you use a CTreeView rather than a CTreeCtrl?
(and)
>> Replace the current view class for the tree control with CTreeView.
Huh? I don't think the solution to the problem is to "use something else". There must
be a reason the view is not getting WM_SIZE messages when you resize the splitter.
I make extensive use of my own tree and list view classes that are derived from a
normal CView with an embedded common control. I purposely chose not to use the
new CTreeView and CListView classes for a variety of technical reasons. And I use these
views within splitter windows with no problems.
Without looking at the code, I can't say for sure what the problem may be, but suffice
to say it is possible. An view with an embedded child tree control inside a splitter
window should not cause you any problems.
(Feel free to send me any code snippets directly to jkoral@ftp.com. Or if you like, I
could send you some sample code that does just this and doesn't exhibit the problems
you describe).
- Joseph
-----From: sundar@ai.mit.edu (Sundar Narasimhan)
There's one place where this suggested technique doesn't exactly
apply. (i.e. when the CTreeCtrl needs to be inside of a CFormView derived
class). I know the original poster didn't post enough detail to tell
if this was what his problem was are not, but the problem has shown up
for us when we wanted to have multiple form views inside of a CTabCtrl.
We couldn't really use CTreeViews either.
Date: Tue, 6 Feb 1996 09:26:49 +0100
From: Regis VAQUETTE
Sender: owner-mfc-l@netcom.com
Precedence: list
Reply-To: mfc-l@netcom.com
[Mini-digest: 2 responses]
> I have a splitter window with 2 views. One of the views holds a
> CTreeCtrl. Whenever the child window is resized I get an OnSize
> message and manually have to resize the CTreeCtrl. However, whenever
> the splitter window is resized, the message doesn't come through the
> OnSize. Can someone help me here as I have tried asking in other areas
> without getting a response back. Thanks.
>
Why don't you use a CTreeView rather than a CTreeCtrl ? I think that this type
of View is advised by Microsoft if we want to use it in a spliter wmd.
-----From: Mario Contestabile
[Start()]
I have a splitter window with 2 views. One of the views holds a
CTreeCtrl. Whenever the child window is resized I get an OnSize
message and manually have to resize the CTreeCtrl. However, whenever
the splitter window is resized, the message doesn't come through the
OnSize. Can someone help me here as I have tried asking in other areas
without getting a response back. Thanks.
[Stop()]
Replace the current view class for the tab control with CTreeView.
mcontest@universal.com
Jim Lavin -- ooptech@Onramp.NET
Thursday, February 08, 1996
[Mini-digest: 2 responses]
At 09:56 AM 2/5/96, you wrote:
>
> I have a splitter window with 2 views. One of the views holds a
> CTreeCtrl. Whenever the child window is resized I get an OnSize
> message and manually have to resize the CTreeCtrl. However, whenever
> the splitter window is resized, the message doesn't come through the
> OnSize. Can someone help me here as I have tried asking in other areas
> without getting a response back. Thanks.
>
>
Have you looked at the MFC Source to see what happens when the splitter is
moved. I believe there is a function such as OnResizeSplitter or something
of that nature. They are probably performing a MoveWindow() on each of the
children after it has been moved.
Jim Lavin
OOP Technologies
http://emporium.turnpike.net/~jlavin
http://rampages.onramp.net/~ooptech
I've seen programmers who couldn't be passed by reference or by value!
-----From: Jim Leavitt
Sundar wrote:
-----From: sundar@ai.mit.edu (Sundar Narasimhan)
There's one place where this suggested technique doesn't exactly
apply. (i.e. when the CTreeCtrl needs to be inside of a CFormView =
derived
class). I know the original poster didn't post enough detail to tell
if this was what his problem was are not, but the problem has shown up
for us when we wanted to have multiple form views inside of a CTabCtrl.=20
We couldn't really use CTreeViews either.
This is a little off the original thread, but I've found the mix of =
splitter windows, CTabCtrls, CTreeViews, and even CDaoRecordViews to be =
useful and well mannered (so far anyway). =20
Heres the architecture:
CCtrlView -> CTabView. Look at the implementation for a CTreeView and =
just put a TabCtrl in its place.=20
So now the TabView resizes with the splitter or frame window. There were =
a few hiccups, I had to override OnEraseBackground. Otherwise the view =
would flash whenever a child control redrew. That wasn't too hard =
either, basically the agenda is go create a region the excludes the part =
of the tabCtrl where you're placing your treeViews, forms, etc. and the =
view's clipRect . Get your preferred color and paint the region. =
OnChildNotify gets TabCtrl messages back for processing.
As for sizing the controls, forms etc that populate the CTabView, just =
override WM_SIZE. Your OnSize function calculates the new size of any =
form or control child by calling GetClientRect, then subtracting the =
height of a Tab, (GetItemRect) and insetting to any margin you prefer =
(DeflateRect). Once you've got this rect, move all your child windows =
there, visible and hidden.=20
Anyway, I'll be glad to share any of this if there's any interest.
Jim Leavitt.
| Вернуться в корень Архива
|