我用 m_MySplitterWnd.DeleteView(0, 1); 删除一个窗口后再创建时
它并没有调用OnInitialUpdate是什么原因
我在OnInitialUpdate里初始化了一个list 它并没有显示出来 CWnd *pView=m_MySplitterWnd.GetPane(0,1);
if (pView==NULL)
return;
CRuntimeClass *pViewClass = NULL;
if (pView->IsKindOf(RUNTIME_CLASS(CYZJDataDailyDialog)))
{
pViewClass = RUNTIME_CLASS(CYZJDataInfoDialog);
}
else
return;
CRect rect;
pView->GetWindowRect(&rect);
m_MySplitterWnd.DeleteView(0, 1);
CCreateContext context;
context.m_pCurrentDoc = GetActiveDocument();
context.m_pCurrentFrame = this;
context.m_pLastView = NULL;
context.m_pNewDocTemplate = NULL;
context.m_pNewViewClass = pViewClass;
if (!m_MySplitterWnd.CreateView(0, 1, pViewClass, rect.Size(), &context))
ASSERT(FALSE);
m_MySplitterWnd.RecalcLayout();
它并没有调用OnInitialUpdate是什么原因
我在OnInitialUpdate里初始化了一个list 它并没有显示出来 CWnd *pView=m_MySplitterWnd.GetPane(0,1);
if (pView==NULL)
return;
CRuntimeClass *pViewClass = NULL;
if (pView->IsKindOf(RUNTIME_CLASS(CYZJDataDailyDialog)))
{
pViewClass = RUNTIME_CLASS(CYZJDataInfoDialog);
}
else
return;
CRect rect;
pView->GetWindowRect(&rect);
m_MySplitterWnd.DeleteView(0, 1);
CCreateContext context;
context.m_pCurrentDoc = GetActiveDocument();
context.m_pCurrentFrame = this;
context.m_pLastView = NULL;
context.m_pNewDocTemplate = NULL;
context.m_pNewViewClass = pViewClass;
if (!m_MySplitterWnd.CreateView(0, 1, pViewClass, rect.Size(), &context))
ASSERT(FALSE);
m_MySplitterWnd.RecalcLayout();
CRuntimeClass* pViewClass, SIZE sizeInit, CCreateContext* pContext)
{
...
BOOL bSendInitialUpdate = FALSE; CCreateContext contextT;
if (pContext == NULL)
{
CView* pOldView = (CView*)GetActivePane();
if (pOldView != NULL && pOldView->IsKindOf(RUNTIME_CLASS(CView)))
{
// set info about last pane
ASSERT(contextT.m_pCurrentFrame == NULL);
contextT.m_pLastView = pOldView;
contextT.m_pCurrentDoc = pOldView->GetDocument();
if (contextT.m_pCurrentDoc != NULL)
contextT.m_pNewDocTemplate =
contextT.m_pCurrentDoc->GetDocTemplate();
} pContext = &contextT;
bSendInitialUpdate = TRUE;
}
... if (bSendInitialUpdate)
pWnd->SendMessage(WM_INITIALUPDATE);
我m_MySplitterWnd.DeleteView(0, 1);之后再
if (!m_MySplitterWnd.CreateView(0, 1, pViewClass, rect.Size(), &context))
发现它并没有执行到InitializeData和OnCreate这是为什么
初始化context时出问题了
指针传错了
结帖