Click here to Skip to main content
15,886,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just created a MDI MFC doc/view app that has a splitter using mfc wizard,but I am wondering how I will add views to my each pane.

Below is the code that MFC generated.

C++
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
	return m_wndSplitter.Create(this,
		1, 2,			// TODO: adjust the number of rows, columns
		CSize(10, 10),	// TODO: adjust the minimum pane size
		pContext);
                
               //I ajusted the number of rows and columns to 1,2.

 
}


My app has more than one document type and I want to bind a different view each to each pane. How do I do it?
Posted

1 solution

You need to declare your view types first, see https://msdn.microsoft.com/en-us/library/ha4x4wc7.aspx[^].
 
Share this answer
 
Comments
Gbenbam 4-Aug-15 6:12am    
I know I have to create the views, but that function is used to create views for static splitters. This is a dynamic splitter. Is there an equivalent function for dynamic splitters? It appears the frame work creates the views of the same view type in dynamic splitting. How do I intercept the view creation in dynamic splitters so as to decide which view type each pane is?
Richard MacCutchan 4-Aug-15 6:21am    
Sorry, I'm not sure, it's quite a while since I used MFC. However, I would expect you just need to manually code what is autogenerated from the templates. The documentation should help you, and there may even be some samples around in the CodeProject articles.
Gbenbam 4-Aug-15 14:04pm    
I have seen that via google search. It is an article on Static Splitter and not dynamic splitter? By the way, what are you using now? Asked because I am thinking of dumping MFC for Qt.
Richard MacCutchan 5-Aug-15 4:06am    
Static or dynamic makes no difference. All Windows have to be created at run time, so the code is much the same. You just need to read it through carefully to see what API calls are made, and how the Views fit in the splitter panes. If that article is not clear enough then I am sure there are many more. See https://msdn.microsoft.com/en-us/library/5xttbe5t.aspx for more information. I only code in pure Win32 since a) MFC does not ship with the Express editions of Visual Studio, and b) I was never a great fan of it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900