Results 1 to 5 of 5

Thread: Tree View control and lots of text = memory hog

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    BFE in Oregon
    Posts
    33

    Cool

    I have 64k of text that I have to place in a treeview control and be able to add to it alphabetically by parent node. Unfortunately that scenario doesn't work the way I need it to, I found some code to copy one treeview to another and then it would work perfectly but there's one problem...It won't work on a machine with 64 megs of ram!
    I'm new to using a treeview control and I can't find any information on the actual use of it on the internet or in reference materials. The code I have to copy one to another probably works great but I am unable to modify it to put it in my program the way I need it.

    I need to iterate through all the nodes from top to bottom as if going through each and every one you come to, Not Roots first then Parents then children.
    Then I need to send the Text and Tag of the node to a subroutine that writes the info to a file.

    If anyone experienced with the TreeView control can help me I would be very appreciative.

    Thanks

  2. #2
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163

    My experience with a Tree View

    Is that it is basically a PITA to use...

    If your text file is just a list or a formatted, you should be fine. But if its a text document (like a paragraph), you're screwed.

    Basicaly you're going to need to set up a way for your code to tell what type of node each line is.

    A good way to do this is to append each line in the file with a prefix character to indicate if it's a parent node or a child node.

    Like this...
    !=Parent
    @=Child

    !My parent listing of text
    @Item 1
    @Item 2
    @Item 3
    !Another Parent listing of text
    @Item 1
    @Item 2
    @Item 3


    You'll also need to tell the code what Parent a Child is attached to, so you may want to add in either a number or text prefix to indicate which parent the child is attached to.

    !X1-My Parent Listing of Text
    @X1-Child text3
    @X1-Child text2


    etc

    Then you tell your code to find the prefix at the beginning of each line and use that to determine where each item is supposed to go. Note that if you use the second method, you don't have to have the items in order, because the prefix will tell the thing wher it's supposed to be.

    Eiredrake

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    BFE in Oregon
    Posts
    33
    The program reads and writes the file perfectly and it has to be in a specific format that doesn't allow for any extra characters, the file is compiled by a different program.
    I need a little code that will iterate through the treeview( not by index value ) and send the .text and .tag to a sub routine.
    For some reason I can't figure out how to iterate through it without creating extra nodes and it's starting to make me angry. Sending the text and tag of each node in order of appearance shouldn't be that hard. It works great if I use the index of each node but then I have to add to the treeview node list and the indexes are created staticly so even if you sort it you can't use the index to output to a file cause what you just added is now at the bottom of the index and will be wrote to the file that way.
    The output has to be in alphabetical order by Parent node not child node. Here's a run down of the file format:

    ; these are comment indicators
    ; this line contains the number of parent nodes eg: 5000 items in list
    ;

    ; each parent node has one of these preceding it in the file
    "Parent nodes and primary child nodes are enclosed in quotes and are no longer than 30 characters"

    "This is a primary child node the following is a secondary node that is a child of the primary and is a hex number stored as a string there is not set limit on the number of primary or secondary nodes"
    8001234 0000
    8002345 0000

    .end ' this signals the end of the parent nodes entry

    ; this process repeats until the file length reaches 64k or approximately 5300 nodes

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    BFE in Oregon
    Posts
    33

    This is a sample file snippet

    ;
    ;1 Game in list
    ;

    ;
    "Perfect Dark"

    "* Hi-Res Codes Below *"

    "Turn Off Bright Lights" .off
    802d23f00020

    "Thermal View" .off
    802c6d630001

    "Infinite Ammo / No Reload" .off
    80206efa00ff
    801edefb00ff
    801d4efb00ff

    "Hi-Res - Enable Code" .off
    ff0002200000

    .end

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    BFE in Oregon
    Posts
    33
    http://www.coolenterprisesonline.com...o/TreeView.gif
    That is a capture of the treeview after parsing the file, the output looks like the above post.
    As you might guess, it's a code list. I need to dynamicly add to it and make sure that each addition gets placed in the correct location in the file, it is a text file.
    Like I said above, everything works perfectly until I add another Game (parent node), it even sorts it correctly but then I can't use the index. I don't like the treeview but it's the only way I can display this much information in a human perceivable form.

    [Edited by Glacius Cool on 08-30-2000 at 08:38 PM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width