Re: I need help with mfc doc/view

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 03/07/04


Date: Sun, 07 Mar 2004 17:59:06 -0500

WHile SDI can support multiple view types, I always worry about SDI apps. I've only
written three of them, and each was a serious mistake. I had to go back and convert them
to MDI. For example, in MDI I could see both views at once; my recollection (which might
be wrong) is that the references allow you to see one or the other view, but not both.

Limiting the user to working on one entity at a time is horribly restrictive, and in
addition makes it really clumsy to work with. For example, I really want two views in an
explorer, the "from" view and the "to" view, but to get these I have to bring up two
explorers, then minimize all my other windows and use the menu bar item "tile
horizontally". This is a horrendous step backward from having a single app in which I
could do this.

(You might be able to use a single splitter view, but that still limits you to working on
one doucment at a time).

In rereading this, it is not clear that you are needing multiple documents as much as
multiple views of a single document that holds the information. Note that "document" does
not necessarily imply "single file instance" although that is the simplest form. If there
is a correlation between two different files, it is possible to treat them as a single
"document" (you write your own open handler, big deal).

A very unfortunate feature of modern file systems is that they have approximately the
sophistication of punched paper tape, stored more densely. The NT file system (I think
this was introduced in Win2K) supports the notion of independent "streams" in a file,
although this feature is all but totally unusable at the moment (you need to open the
files using backup semantics. Echh). Perhaps in Longhorn this will be a first-class
concept. I'd LOVE to have my Visio diagrams be embedded as part of my C source code, so I
could look at both in the same editor. We can only hope...meanwhile, we fake it by doing
things like reading in two files on a file open (double click .aaa, and we implicitly will
open .bbb, double-click .bbb and we will implicitly open .aaa, deal with appropriate
issues if the other one is missing).

While MFC makes it convenient to have one-document-one-file, it does not mandate this at
all. I have one application where the "document" is at the end of a network cable,
embedded in a remote controller, and when a view calls a document method such as
GetValue() or SetValue(), this actually initiates a network transfer from the remote
device! I had another app which had a dozen files as the "document" (I was rewriting an
app that had been written in Basic (not Visual Basic, Basic! and the company had tens of
thousands of historical "documents" like this in their customer base that they needed to
re-analyze at any time...the problem was that they had lost their last programmer. And
they were not willing to change to a database, or change the representation, or to change
the data collection programs, which were still in MS-DOS Basic. So I just ended up reading
a lot of files on a "File Open" and writing a lot on a "Save" or "Save as")
                                joe

On Sun, 7 Mar 2004 12:01:06 -0800, "codeDope" <codeDope@fastmail.com> wrote:

>i'm a newbie to vc++ mfc and stuff ... and am working on a project of developing an IDE for a TCL script file which contains a statements that indicate the state flow of the application script. simply put this script can be diagramatically represented as a kind of STATE FLOW DIAGRAM.
>
>So .. i started with an SDI application that will enable a user to draw the state flow and save the diagramatic document. Now the IDE should essentially enable the user to create the script file from the diagram and vice versa. Therefore i need a text file kinda document support also for my SDI application. ( i.e a diagram editor + a text code editor... for the script).
>
>Can an SDI document have multiple document types ( essentially there will be only one doc instance at a time since its SDI ) .... how to define those document types and how to switch between those types ...? in an sdi appln ... is it technically feasible .. ? please give be advice .. and helpful tutorials and resources on the net.
>
>i am just a rookie and don't have much understanding of MFC and wat goes under the hood... hence am finding it difficult to proceed ...
>
>Thank you.
>niz.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Prevent multiple instances of Excel from starting
    ... I didn't have any confusion as regards multiple Excel instances vs multiple ... Does your app call Excel to reference a particular file (which may or may ... I don't have some malicious intent on making life difficult by randomly ...
    (microsoft.public.excel.programming)
  • Re: MDI in MFC, Conceptually
    ... render the BMP file data in a window and this is typically ... points to the new file data, the new window renders the second image, ... This behavior makes sense if your App contains two ... >> And I can have multiple instances of each type. ...
    (microsoft.public.vc.mfc.docview)
  • MDI in MFC, Conceptually
    ... This is what I understand the way MDI works in the MFC framework: ... wizard builds you a View class, Main and Child frame classes, the App ... have multiple instances of each type. ...
    (microsoft.public.vc.mfc.docview)
  • Re: Rails app organization question
    ... I -really- like Rails, though. ... Have one instance of the app and somehow allow it to use different databases depending on the user's login. ... Have multiple instances of the app running on virtual servers, similar to how cPanel sets up accounts for multiple hosts -- each host has its own directory, MySQL database, and so on. ...
    (comp.lang.ruby)
  • Re: starting point
    ... First rule: creating an SDI app is almost always a serious mistake. ... I've created two SDI apps for serious ... To make an MDI app you need to create a new project. ...
    (microsoft.public.vc.mfc)

Quantcast