Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 2 Doc & 2 Views.

2 Doc & 2 Views.

Scheduled Pinned Locked Moved C / C++ / MFC
designquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    grassrootkit
    wrote on last edited by
    #1

    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.

    S 1 Reply Last reply
    0
    • G grassrootkit

      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.

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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

      G 1 Reply Last reply
      0
      • S Stuart Dootson

        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

        G Offline
        G Offline
        grassrootkit
        wrote on last edited by
        #3

        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?

        S 1 Reply Last reply
        0
        • G grassrootkit

          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?

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          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

          G 1 Reply Last reply
          0
          • S Stuart Dootson

            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

            G Offline
            G Offline
            grassrootkit
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups