I have a question about the necessity of using MFC's built-in document-view architecture. I was given an old dialog-based project in which I have to replace the main dialog with a frame and add a ribon. It has sort of a doc-view architecture, created without the built-in classes and I preffer to reuse it in the new version. However, if I try to bypass the CDoc and CView derivatives, normally generated by the project wizzard, all I can see is an empty window without a ribon. So... do I REALLY have to implement these built-in doc-view architecture, or am I just missing something? Isn't it possible to use the already existing code from the project?
0
votes
It's not mandatory to use Ribbon with standard doc/view. What's your problem?
- Adriano Repetti
My task is to add a ribbon. My problem is how to correctly implement the architecture. If I don't use the built-in classes for document and view(which seem to have nothing to do with the ribbon :/), the window remains blanc. On the other hand, the program works with lots of data, which is not storred in files. It comes as an inputs on the COM port, so I'm not quite sure if the built-in functions can handle it :/
- Stoyanov
I mean: porting from an old MFC version can be painful. Why don't you create a new project (with Ribbon and without doc/view support) then start to copy & paste into the old project? Base classes, definitions and so on...
- Adriano Repetti
That's a lot of code. LOADS of it :D
- Stoyanov
Yes but you have to change only few classes (well, of course everything was in a menu/toolbar must be moved to Ribbon...). AFAIK there is not a simple solution for this kind of porting.
- Adriano Repetti
1 Answers
1
votes
If you will be using multiple views & documents in your frame then it is advisable to use the existing framework's design (CDocument, CView etc).
If you are doing it only for ribbon and will be just moving your controls from dialog to frame then you can skip the standard Document/View architecture and directly instantiate ribbon control.
If you don't have to re-write a lot of code, then I would suggest that you use standard Document/View architecture as in a long run it will save a lot of time, make your app scalable to a bigger multi-doc design etc.