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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Preserve Cotents of Tree Control after doing a DoModal?

How to Preserve Cotents of Tree Control after doing a DoModal?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structurestutorial
8 Posts 2 Posters 2 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.
  • S Offline
    S Offline
    Stuck At Zero
    wrote on last edited by
    #1

    What is the best way for preserving a tree control on its own dialog form that is called with a doModal? I need to be able to access the contents of the tree control after a user would hit the OK button.

    C 1 Reply Last reply
    0
    • S Stuck At Zero

      What is the best way for preserving a tree control on its own dialog form that is called with a doModal? I need to be able to access the contents of the tree control after a user would hit the OK button.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Stuck At Zero wrote:

      I need to be able to access the contents of the tree control after a user would hit the OK button.

      In general, the way to handle that is to retrieve the relevant information from the list control on the OnOk handler of your dialog (so, you store all the information you need into strings, integers or whatever non-GUI variables). Then, outside this class you can then access those members (preferably through get functions).

      Cédric Moonen Software developer
      Charting control [v1.3]

      S 2 Replies Last reply
      0
      • C Cedric Moonen

        Stuck At Zero wrote:

        I need to be able to access the contents of the tree control after a user would hit the OK button.

        In general, the way to handle that is to retrieve the relevant information from the list control on the OnOk handler of your dialog (so, you store all the information you need into strings, integers or whatever non-GUI variables). Then, outside this class you can then access those members (preferably through get functions).

        Cédric Moonen Software developer
        Charting control [v1.3]

        S Offline
        S Offline
        Stuck At Zero
        wrote on last edited by
        #3

        The problem I have is that there are 16,384 combinations for the user to specify. I originally thought of using a multi-dimensional array of 5 dimensions but I felt this was going to be ugly. I then thought of trying to do a bit map but it seems MFC doesn't support this. Finally I just decided that transferring things from the tree control was a waste of time so I was going to simply retraverse the tree as needed. But with the tree control "disappearing" after the OK button is hit, I've been thinking of simply making a regular tree to transfer the contents of the tree control over to the tree but MFC has no such thing it seems. If I go the path you suggest, I'm thinking this will push me towards a 5-dimensional C-String array... but I'm right back where I started it seems.

        C 1 Reply Last reply
        0
        • C Cedric Moonen

          Stuck At Zero wrote:

          I need to be able to access the contents of the tree control after a user would hit the OK button.

          In general, the way to handle that is to retrieve the relevant information from the list control on the OnOk handler of your dialog (so, you store all the information you need into strings, integers or whatever non-GUI variables). Then, outside this class you can then access those members (preferably through get functions).

          Cédric Moonen Software developer
          Charting control [v1.3]

          S Offline
          S Offline
          Stuck At Zero
          wrote on last edited by
          #4

          My tree is a user-specified filtering device composed of 8 root nodes. Each root node represents a bus. Each bus has 32 nodes called RTs. Each RT node has 2 nodes; One called Transmit, the other called Receive. Each Transmit / Receive node has 32 nodes called Message. The tree is 4 levels deep. I have also been asked to make it such that if all sibling nodes of a given level are not selected, but that the parent node of these sibling nodes is selected, that this implies a wildcard for all the sibling nodes and their decedents.

          1 Reply Last reply
          0
          • S Stuck At Zero

            The problem I have is that there are 16,384 combinations for the user to specify. I originally thought of using a multi-dimensional array of 5 dimensions but I felt this was going to be ugly. I then thought of trying to do a bit map but it seems MFC doesn't support this. Finally I just decided that transferring things from the tree control was a waste of time so I was going to simply retraverse the tree as needed. But with the tree control "disappearing" after the OK button is hit, I've been thinking of simply making a regular tree to transfer the contents of the tree control over to the tree but MFC has no such thing it seems. If I go the path you suggest, I'm thinking this will push me towards a 5-dimensional C-String array... but I'm right back where I started it seems.

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            What do you need to do with this data ? Do you really need to retrieve the complete tree structure ? If the tree control was not destroyed, what would you extract as information ?

            Cédric Moonen Software developer
            Charting control [v1.3]

            S 1 Reply Last reply
            0
            • C Cedric Moonen

              What do you need to do with this data ? Do you really need to retrieve the complete tree structure ? If the tree control was not destroyed, what would you extract as information ?

              Cédric Moonen Software developer
              Charting control [v1.3]

              S Offline
              S Offline
              Stuck At Zero
              wrote on last edited by
              #6

              I'm building an app that displays data from a binary file on a virtual grid. Since the binary file is huge, users want to be able to filter out unwanted data. I won't know if any given set of data is desired until after I read it in and check it against the tree. If the message is desired, I keep its location stored. If the message is not desired, I discard its location while the virtual grid periodically updates itself based on what my app discovers to be desirable data.

              C 1 Reply Last reply
              0
              • S Stuck At Zero

                I'm building an app that displays data from a binary file on a virtual grid. Since the binary file is huge, users want to be able to filter out unwanted data. I won't know if any given set of data is desired until after I read it in and check it against the tree. If the message is desired, I keep its location stored. If the message is not desired, I discard its location while the virtual grid periodically updates itself based on what my app discovers to be desirable data.

                C Offline
                C Offline
                Cedric Moonen
                wrote on last edited by
                #7

                In the extreme case, if you really need to keep the complete structure can't you model it ? Something like a node class which contain data (its name for example, or extra information) and a list of nodes, which are its children. It's a bit more intuitive than a 5 dimensional string array :~ Of course you can add helper functions in that class to make browsing of the children easier.

                Cédric Moonen Software developer
                Charting control [v1.3]

                S 1 Reply Last reply
                0
                • C Cedric Moonen

                  In the extreme case, if you really need to keep the complete structure can't you model it ? Something like a node class which contain data (its name for example, or extra information) and a list of nodes, which are its children. It's a bit more intuitive than a 5 dimensional string array :~ Of course you can add helper functions in that class to make browsing of the children easier.

                  Cédric Moonen Software developer
                  Charting control [v1.3]

                  S Offline
                  S Offline
                  Stuck At Zero
                  wrote on last edited by
                  #8

                  Understood on the node class... I was hoping to avoid that and utilize something more straightforward without having to use a new class for that.

                  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