Archived

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

MFC Document/View - New Milestone :: C++

This topic is 5777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I began and finished reading chapter 9 of Promise''s book on MFC today. I believe I have reached a milestone in the journey to become a proficient...good MFC programmer. Here is what I know. MFC = application object->frame window->view->documents Promise emphasized that documents as an abstract concept object including data. I interpret documents as dealing with the program''s "purpose" i.e. program theme. Nonetheless, I have not come to a complete understanding as to what comes first: view or documents. For example, as program designer and developers, we should always walk the steps of a program user. I am not completely sure as to where is the clear separation of view and documents, event though view is the program interpreter. View does the drawing according to the data from documents. For example, let say I am working on a program that reads data from a file and puts it on a window in *binary* mode. Let say I create three classes using AppWizard and ClassWizard: 1) ConceptPro (mainframe window) 2) view 3) document First, the classes above are MFC''s generated classes. Conception is the application object and it handles all the taskbar, menu, etc. View draws the childframe, *binary* data from a file, etc. Documents handles the data such as filename, file data, etc. Is the description above valid? Please point out where I am "going off track" or "missed something important." 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. Thanks, Kuphryn

Share this post


Link to post
Share on other sites
Well id say that if its being formated by the other class right before being outputted then id put it in the view class, but if its being formated right after being loaded id put it into the document class. Just think about it this way, if its being formated for display then its a view, if its being formated for storage then its a document.

"Computer games don''t affect kids; I mean if Pac-Man affected us as kids, we''d all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
- Kristian Wilson, Nintendo, Inc, 1989

Share this post


Link to post
Share on other sites
Thanks.

You answered up my question about the role of view and document, especially when you said, "if its being formated for display then its a view, if its being formated for storage then its a document."

Also, how about determining where to include command and command handlers, including updates? If I remember correctly, Promise emphasizes any commands having to do with the mouse and keyboard should be in view.

MFC is very powerful. Microsoft designed MFC to be flexible. For example, I was not clear as to how a view object knows when to draw an interpretting of document data on the screen. I believe documents calls friends classes of view. That is flexible.

Kuphryn

Share this post


Link to post
Share on other sites