Archived

This topic is now archived and is closed to further replies.

msiren

Trouble with MFC+SplitterWnd and DirectX

Recommended Posts

msiren    136
I have this little problem with window splitters in MFC. So here''s the deal: I create a SDI dov/view application and then I split my view into two rows. On the upper row I create a view with initializes my engine that uses directx 8.1. The initialization is done in the OnInitialUpdate method of the view class(derived from CView) On the lower row I create CFormView. Everything is fine except for the fact that I don''t want this kind of layout =) Now I split the upper row into two columns by creating a new dynamic CSplitterWnd and create a new view on lower row. Then I create my view class to the new window splitter''s first column and another CFormView in the second column. Now the problem is that my engine won''t initialize because at the point that the OnInitialUpdate is invoked the m_hWnd of view class isn''t initialized yet. Can anyone help me with this? ps. sorry for my bad english. Code: // Create the first splitter ... if( !m_wndMainSplitter.CreateStatic(this, 2,1) ) { TRACE0("Failed to create splitter window\n"); return FALSE; } // Create the splitter inside the upper row in the first splitter ... m_wndBarSplitter = new CSplitterEx; if( !m_wndBarSplitter->CreateStatic( &m_wndMainSplitter, 1,2, WS_CHILD|WS_VISIBLE|WS_BORDER, m_wndMainSplitter.IdFromRowCol(0,0)) ) { TRACE0("Failed to create the second splitted!"); return FALSE; } // Create the views ... // The "info" view m_wndMainSplitter.CreateView(1, 0, RUNTIME_CLASS(CInfoScreen), CSize(246, 100), pContext); // Main view m_wndBarSplitter->CreateView(0, 0, RUNTIME_CLASS(CMeshView), CSize(640,480), pContext); // The "tool" view m_wndBarSplitter->CreateView(0, 1, RUNTIME_CLASS(CMeshModification), CSize(200, 100), pContext); // Give the "tool" class the splitter window.... ((CMeshModification*)(m_wndBarSplitter->GetPane(0,1)))->m_viewArea = m_wndBarSplitter; // Same goes for the info view... ((CInfoScreen*)(m_wndMainSplitter.GetPane(1,0)))->m_viewArea = m_wndBarSplitter;

Share this post


Link to post
Share on other sites
msiren    136
Oh yes I made a nasty hack to make this work.
I create a CMeshModification in the "main" view and on the CMainFrame''s OnSize I change the view to CMeshViewerView.

Share this post


Link to post
Share on other sites