15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dynamically switching CSplitterWnd panes

Felipe -- jordaof@moodys.com
Thursday, September 05, 1996


Environment: Visual C++ 4.2 with 4.2a patch; Windows NT 4.0 WS

I have a static splitter window with a treeview on the left and a form   
view on the right.  I want to flip the form view to a different form view   
when the user clicks a button.  (note: I already saw the split example   
from MS).  I have the funtion that switches the view in the MainFrame   
class as well as a member variable of class CSplitterWnd.  Here's the   
problem:

 - when MFC calls OnCreateClient() the CMainFrame pointer is X.

 - when MFC returns to OnCreate() from OnCreateClient() the pointer is X

 - when I call AfxGetMainWnd() from the view class/pane to switch views   
the pointer I get is X.  At this point, the view uses the CMainFrame   
pointer to call the CMainFrame::SwitchView() function, and the call   
works.

 - when I click on "step" in the debugger (which takes me to the beginning   
of the CMainFrame.SwitchView() function) the CMainFrame pointer is now   
*Y* and an ASSERT_VALID(this) fails.

however, if I call AfxGetMainWnd at the beginning of SwitchView() I get   
the X pointer for CMainFrame as it should be.

any ideas why the pointer to the CMainFrame changes from one function to   
the next?  Is there something I'm missing here?  Is CMainFrame the wrong   
place to put a function that manipulates it's own CSplitterWnd variable?

thanks

Felipe
jordaof@moodys.com  



GoroKhM1 -- gorokhm1@SMTP.ATG-NET.COM
Friday, September 06, 1996

     
Hi Felipe,

The article Q149257 "Split32: How to Replace a View in a Splitter Window" 
may help you. The method in it works fine in my app, which is exact as yours.

If your need some code, let me know.

-Mark

MarkG@usa.net

______________________________ Reply Separator _________________________________
Subject: Dynamically switching CSplitterWnd panes
Author:  mfc-l@netcom.com at INTERNET
Date:    9/5/96 10:42 AM


     
Environment: Visual C++ 4.2 with 4.2a patch; Windows NT 4.0 WS
     
I have a static splitter window with a treeview on the left and a form   view 
on the right.  I want to flip the form view to a different form view   when 
the user clicks a button.  (note: I already saw the split example   from MS). 
 I have the funtion that switches the view in the MainFrame   class as well 
as a member variable of class CSplitterWnd.  Here's the   problem:
     
 - when MFC calls OnCreateClient() the CMainFrame pointer is X.
     
 - when MFC returns to OnCreate() from OnCreateClient() the pointer is X
     
 - when I call AfxGetMainWnd() from the view class/pane to switch views   
the pointer I get is X.  At this point, the view uses the CMainFrame   
pointer to call the CMainFrame::SwitchView() function, and the call   
works.
     
 - when I click on "step" in the debugger (which takes me to the beginning   
of the CMainFrame.SwitchView() function) the CMainFrame pointer is now   
*Y* and an ASSERT_VALID(this) fails.
     
however, if I call AfxGetMainWnd at the beginning of SwitchView() I get   
the X pointer for CMainFrame as it should be.
     
any ideas why the pointer to the CMainFrame changes from one function to   
the next?  Is there something I'm missing here?  Is CMainFrame the wrong   
place to put a function that manipulates it's own CSplitterWnd variable?
     
thanks
     
Felipe
jordaof@moodys.com  





| Вернуться в корень Архива |