|
-
May 13th, 1999, 02:38 PM
#1
Dynamically deleting views from splitter window...
I have a SDI project in where the CMainFrame class contains a splitter window. I am currently at run time changing the views in the right pane. I am also associating the view with the document. All of this works fine. The problem is if I do any kind of serializing, it hangs up in the function CWnd: estroyWindow() on the call : estroyWindow(m_hwnd). In my document class I have overridden the virtual function SaveModified. I have even taken all of that code out and put the same functionality in my CMainFrame class and just let the document worry if the view has been modified and I get the same thing. Any help would be appreciated.
Thanks,
Wayne
-
May 13th, 1999, 03:00 PM
#2
Re: Dynamically deleting views from splitter window...
hi!
do u think that u could post a bit of the code on this forum. That would really help to understand what exactly u want to do.
-
May 13th, 1999, 03:31 PM
#3
Re: Dynamically deleting views from splitter window...
Sorry for not showing any code but I am not sure if this is where I have the problem, like I said before, it works fine except after I save the views data to the disk.
This is how it works, I click on something in the left pane, which sends a message to my CMainFrame class, which in turn decides whether it needs to change the view. If it decides to change the view it calls the following function.
ChangeViews(RUNTIME_CLASS(CSomeView));
And it hangs on the call
m_Splitter.DeleteView(0, 1);
I have followed it all the way into the CWnd: estroyWindow() call and everything looks ok. But when it calls : estroyWindow(m_hwnd), it hangs.
Here is the function that I use to switch views:
bool CMainFrame::ChangeViews(CRuntimeClass * pViewClass)
{
// Set no active view since we are destroying the only view
SetActiveView(NULL, FALSE);
CView * pView = (CView*) m_Splitter.GetPane(0, 1);
ASSERT_VALID(pView);
CEstimatorDoc * pDoc = (CEstimatorDoc *) pView->GetDocument();
ASSERT_VALID(pDoc);
BOOL bSaveAutoDelete = pDoc->m_bAutoDelete;
pDoc->m_bAutoDelete = FALSE;
m_Splitter.DeleteView(0, 1); // this is where it hangs when it calls
// : estroyWindow()
CCreateContext context;
context.m_pCurrentDoc = pDoc;
context.m_pNewDocTemplate = pDoc->GetDocTemplate();
context.m_pNewViewClass = pViewClass;
context.m_pLastView = pView;
context.m_pCurrentFrame = this;
m_Splitter.CreateView(0, 1, pViewClass, CSize(0,0), &context);
m_Splitter.RecalcLayout();
pDoc->m_bAutoDelete = bSaveAutoDelete;
pDoc->SetModifiedFlag(FALSE);
pView = (CView*) m_Splitter.GetPane(0, 1);
ASSERT_VALID(pView);
pView->SendMessage(WM_INITIALUPDATE);
SetActiveView(pView);
m_pCurrentView = pView;
// Update all views
pDoc->UpdateAllViews(NULL);
return true;
}
Thanks,
Wayne
-
May 14th, 1999, 04:48 PM
#4
Re: Dynamically deleting views from splitter window...
I have been wanting to switch Splitter Views myself in exactly this fashion, however the docs tell me that "You must specifically create all the static splitter’s panes when you create the static splitter" which implies that you cannot remove them yourself, once created. On destruct DeleteView() "is called by the framework to implement the logic of the dynamic splitter window ". This may be why calling the member function yourself causes a crash.
I hope, and suspect there may be a way around this....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|