-
April 7th, 2014, 03:35 PM
#1
Adding Splitter Windows Makes Mainframe Unable to Get Current Document
Hello,
I created two split views like this:
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext )
{
CFrameWnd::OnCreateClient(lpcs, pContext);
if (!m_wndSplitter.CreateStatic (this, 2, 1) ||
!m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS (CFirstView),
CSize (0, 256), pContext) ||
!m_wndSplitter.CreateView (1, 0, RUNTIME_CLASS (CSecondView),
CSize (0, 0), pContext))
return FALSE;
return TRUE;
}
Then I added a menu item and get it handled:
void CMainFrame::OnAlohaHowAreYou()
{
m_pDoc = (CAlohaDoc*)GetActiveDocument();
m_pDoc->SayHowAreYou();
}
When I step into CMainFrame::OnAlohaHowAreYou(), I found m_pDoc is NULL. If I remove the split views and make CMainFrame::OnCreateClient() like below, then there is no problem.
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext )
{
CFrameWnd::OnCreateClient(lpcs, pContext);
return TRUE;
}
What could be wrong?
Thanks,
Brian
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
|