Click here to Skip to main content
16,007,760 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is there WinAPI equivalent to strrchr() ? Pin
Gavin Jerman22-Feb-02 2:00
Gavin Jerman22-Feb-02 2:00 
GeneralRe: Is there WinAPI equivalent to strrchr() ? Pin
Nish Nishant22-Feb-02 3:09
sitebuilderNish Nishant22-Feb-02 3:09 
GeneralRe: Is there WinAPI equivalent to strrchr() ? Pin
Joaquín M López Muñoz22-Feb-02 3:21
Joaquín M López Muñoz22-Feb-02 3:21 
AnswerRe: Is there WinAPI equivalent to strrchr() ? Pin
Nish Nishant22-Feb-02 3:10
sitebuilderNish Nishant22-Feb-02 3:10 
GeneralUuidCreate under windows CE Pin
Emmanuel Derriey21-Feb-02 22:43
Emmanuel Derriey21-Feb-02 22:43 
QuestionHow to Get System Resources utilization Pin
21-Feb-02 21:56
suss21-Feb-02 21:56 
GeneralMFC Document/View - New Milestone :: C++ Pin
valikac21-Feb-02 20:52
valikac21-Feb-02 20:52 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
Paul M Watt21-Feb-02 21:18
mentorPaul M Watt21-Feb-02 21:18 
IMO I believe that the Document should be designed first. It is possible to create multiple views of the same document. In fact, each of these views can display some different aspect of your document. Therefore, because the Document is the item that all of the views have in common, the document is the object that should be designed first.

It may be useful however, to take into account what you want your view to display, this may give you some clues as to the types of data that may be required in your Document object, but may not be immediately apparent.

kuphryn wrote:
Lastly, let say I have other classes that manipulate the data in the file *before* outputing it. Where should I instantiate these classes in documents or in view? I am not completely clear as to rank of document and view.

Here is an attempt to create a quick diagram of a clean design for what you have described.
This is not an inheritance model, but a model of the owners of all of the objects. The arrows
point to the child objects that a parent object owns.

--------------------------------------------------
|                                                |
|   Main Window                                  |
|                                                |
--------------------------------------------------
      |        |        |                 |
      |        |        |                 |
      |        |        |                 |
      V        |        V                 V
 ------------  |  -------------     --------------
 |  View 1  |  |  |  View 2   |     |   Document |
 ------------  |  -------------     |   Mutator  |
               |                    -------------- 
               |                    
               V
        ----------------
        |  Document    |
        ----------------


In this diagram, all of the objects are owned by the main window, the simply point to the document, and use the data in the document. View the Document as a piece of data with accessor functions.

With this in mind then you will need other classes that manage the data (document mutators), whether you edit it with an edit control or some other method. These items should be owned and controlled by the main window / main module. This allows the data to be separated from the implementation. This design would also allow you to reuse the document object that you created in a completely different app with a completely different front end (optimal code resue).

While I know that this is not always the final result in the practice of software engineering, it is a main goal of object oriented software design.
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
valikac22-Feb-02 5:03
valikac22-Feb-02 5:03 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
Paul M Watt22-Feb-02 7:01
mentorPaul M Watt22-Feb-02 7:01 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
valikac22-Feb-02 10:10
valikac22-Feb-02 10:10 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
22-Feb-02 2:59
suss22-Feb-02 2:59 
Generalfile - streams... Pin
Bernhard21-Feb-02 19:55
Bernhard21-Feb-02 19:55 
GeneralRe: file - streams... Pin
Joaquín M López Muñoz21-Feb-02 20:16
Joaquín M López Muñoz21-Feb-02 20:16 
GeneralRe: file - streams... Pin
Bernhard21-Feb-02 20:38
Bernhard21-Feb-02 20:38 
GeneralRe: file - streams... Pin
Joaquín M López Muñoz21-Feb-02 22:45
Joaquín M López Muñoz21-Feb-02 22:45 
GeneralRe: file - streams... Pin
Bernhard22-Feb-02 0:06
Bernhard22-Feb-02 0:06 
GeneralRe: file - streams... Pin
22-Feb-02 9:18
suss22-Feb-02 9:18 
General2D Color Gradient or Ramp Pin
Paul Selormey21-Feb-02 17:50
Paul Selormey21-Feb-02 17:50 
GeneralRe: 2D Color Gradient or Ramp Pin
Christian Graus21-Feb-02 18:16
protectorChristian Graus21-Feb-02 18:16 
GeneralRe: 2D Color Gradient or Ramp Pin
Paul Selormey23-Feb-02 19:50
Paul Selormey23-Feb-02 19:50 
GeneralMemory DC to CBitmap object Pin
Wolfram Steinke21-Feb-02 17:33
Wolfram Steinke21-Feb-02 17:33 
GeneralRe: Memory DC to CBitmap object Pin
Christian Graus21-Feb-02 18:19
protectorChristian Graus21-Feb-02 18:19 
Generalquestion about LNK2005 and LINK1169 Pin
RK_200021-Feb-02 11:52
RK_200021-Feb-02 11:52 
GeneralRe: question about LNK2005 and LINK1169 Pin
Michael Dunn21-Feb-02 12:11
sitebuilderMichael Dunn21-Feb-02 12:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.