2 Doc & 2 Views.
-
Imagine an application that will have two documents. Eg : Doc1.txt & Doc2.txt. I need to view them both at the same time in a single window separated by a splitter. How should I design the application? Some points to be considered. 1. There'll never be any need for another document Doc3. Can I go for any static design that has only 2 docs? 2. I should have two independent "open file" menu item in the file menu to open Doc1 & another for Doc2. Don't have any clue what's it all about. I just came out of SDI stuff. Now it's MDI's turn. Can someone through some light on sequence of steps that's need to achieve this requirement? Thanks.
-
Imagine an application that will have two documents. Eg : Doc1.txt & Doc2.txt. I need to view them both at the same time in a single window separated by a splitter. How should I design the application? Some points to be considered. 1. There'll never be any need for another document Doc3. Can I go for any static design that has only 2 docs? 2. I should have two independent "open file" menu item in the file menu to open Doc1 & another for Doc2. Don't have any clue what's it all about. I just came out of SDI stuff. Now it's MDI's turn. Can someone through some light on sequence of steps that's need to achieve this requirement? Thanks.
Leave it as an SDI app. Have a 'composite document' type that represents the two documents as a single document (as far as MFC is concerned, it's a single document). Have a single File->Open command that ensures two documents are opened to make a valid composite (the composite needs two documents, remember) but (if you want) have a UI that allows the user to open a document to replace one of the documents in the composite. This way, you are retaining the single document<->view relationship that an MFC SDI app is built upon. And yes, I've done this, for a tool I wrote that could either plot a file of data, or plot two files of data so that you got variables of the same name plotted on the same graph.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
Leave it as an SDI app. Have a 'composite document' type that represents the two documents as a single document (as far as MFC is concerned, it's a single document). Have a single File->Open command that ensures two documents are opened to make a valid composite (the composite needs two documents, remember) but (if you want) have a UI that allows the user to open a document to replace one of the documents in the composite. This way, you are retaining the single document<->view relationship that an MFC SDI app is built upon. And yes, I've done this, for a tool I wrote that could either plot a file of data, or plot two files of data so that you got variables of the same name plotted on the same graph.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
The idea sounds very cool. Thanks a lot. Also, rather than having a single File->Open command, what if I have two separate File-Opens and manage the composite document with global flags? I can open a document through "open 1st doc" & then signal the flag as "Opened through 1st file" similarly for 2nd doc. And once the 2nd doc is loaded, the composite doc is built. This way the user will be allowed to view just 1 doc or view both. Sounds feasible? Or something's fundamentally wrong with his idea?
-
The idea sounds very cool. Thanks a lot. Also, rather than having a single File->Open command, what if I have two separate File-Opens and manage the composite document with global flags? I can open a document through "open 1st doc" & then signal the flag as "Opened through 1st file" similarly for 2nd doc. And once the 2nd doc is loaded, the composite doc is built. This way the user will be allowed to view just 1 doc or view both. Sounds feasible? Or something's fundamentally wrong with his idea?
grassrootkit wrote:
manage the composite document with global flags
The word 'global' always rings alarm bells :-) If they're part of the document class, that's probably better.
grassrootkit wrote:
I can open a document through "open 1st doc" & then signal the flag as "Opened through 1st file" similarly for 2nd doc. And once the 2nd doc is loaded, the composite doc is built. This way the user will be allowed to view just 1 doc or view both. Sounds feasible?
Probably - I had a single document for both the 'single file' and 'two files' cases. The document knew what sort of document it was (one or two files), and managed things appropriately. It all depends what the requirements are really.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
grassrootkit wrote:
manage the composite document with global flags
The word 'global' always rings alarm bells :-) If they're part of the document class, that's probably better.
grassrootkit wrote:
I can open a document through "open 1st doc" & then signal the flag as "Opened through 1st file" similarly for 2nd doc. And once the 2nd doc is loaded, the composite doc is built. This way the user will be allowed to view just 1 doc or view both. Sounds feasible?
Probably - I had a single document for both the 'single file' and 'two files' cases. The document knew what sort of document it was (one or two files), and managed things appropriately. It all depends what the requirements are really.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Stuart Dootson wrote:
The word 'global' always rings alarm bells
lol yes that would. Actually I planned to bring it in into the design. But to quickly explain you about what I thought I meant them as global. :) Anyway thanks a lot.. let me get into the lab :D.