Click here to Skip to main content
15,998,100 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I want to create an MFC application that has a tree view on the left hand side and a document view on the right-hand side. I want to be able to open a file into the right hand document view and use the contents of a different file to populate the left hand tree-view. Do I need MDI or can i use SDI. I don't want all the seperate child windowns that you seem to get with MDI, I just want one main frame with the explorer style.
Posted

You don't need a MDI layout to represent a couple of views... And you can use data and the interface to accomodate your needs... you could even use a dialog app and put standard controls into it...

This truly depends on the kind of data organization you will use...

You should think on how you will organize the data and how you want to show it...

Could you update your question and add more details?

Hope this helps! :thumbsup:


[Update]
You could use a SDI application layout with a treeview and an editview separated using a splitter... Also you could use a dialog application that usually is much easier to prepare and put two controls there: CTreeCtrl and CEdit.

It's up to you... both ways will work fine.
[/Update]
 
Share this answer
 
v2
Comments
Jackie Lloyd 25-May-11 10:59am    
Thanks for a very speedy reply - does this make things clearer?

The user will be able to use the menu bar File->Open option to open a CFileDialog and then select a .txt or .doc file into the right-hand pane.

I am creating a new menu bar item to open a CFileDlg which allows the user to select an XML file which contains the contents that the tree-view should display.

The user could therefore have 2 files open, one file is displayed in the tree-view and the other in the right-hand view.

I can't see how to do this unless I have a different document class for each view. But when I select MDI when I create a new MFC app, it comes up with lots of explorer style frames within the main frame, which is not what i want.
Sergey Alexandrovich Kryukov 25-May-11 14:00pm    
Agree, my 5. However, my opinion is that MDI is totally unacceptable.

Please see my answer.
--SA
If you want a good friendly advice for staying out of trouble, listen to it: never use MDI. It is strongly discouraged, even my Microsoft where is was introduced. Best of all, make some tabbed interface. It will give you more than enough room for multiple views. Could be something else as well. Alternatively (or additionally), if you need to see to views side-by-side, make if in one windows split by a splitter.

Look at the TotalCommander, for a very good example: http://en.wikipedia.org/wiki/Total_Commander[^].

Please also see this:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^].

Explanations in my past answers:
Question on using MDI windows in WPF[^],
MDIContainer giving error[^].

See also recent discussion:
Dynamicaly Load forms depending on assemblies[^].

—SA
 
Share this answer
 

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