Hi David, In the Experiment where you did not populate the leaf nodes and it went fast, did you remove the line: Dim TVBranch: Set TVBranch = TV( ArtistName)
If you did, could you repeat this experiment but leave the above line in place (obviously it won't be doing anything, but I have a hunch it's taking a long time to locate the artist branch for each album, and I'd like to see if that's so). I looked at my own code where I put together a large treeview (but nothing like yours), and I am populating all the leaves for a given branch at once, so I am able to store the branch I'm working with in a variable and never have to look it up a second time. Perhaps you could find some way to store all the leafs in a dictionary object, which would then allow you to populate a branch all at once if it turns out that looking up the branch is what is taking most of your time. Hth, Chip Chip Orange Florida Public Service Commission Computer Systems Analyst 850-413-6314 -----Original Message----- From: Scripting [mailto:scripting-bounces+corange=psc.state.fl...@lists.window-eyes.com] On Behalf Of David via Scripting Sent: Saturday, April 09, 2016 3:28 PM To: GWScripting Subject: Treeview, takes an eternity to populate Got a project running here, where I could use a bit of educated feedback. Imagine you have a selection of say 1000 CDs. You decide to catalogue all your collection. You want to divide it into categories, and subcategories. Even, under each subcategory, you may decide it would be nice to sorte each title under its artist. And, somewhere in that herachi, you want to sort by country of origin, and genre of the album. Poof, there we have one description that might parallel with my project. To best handle the categorizing issue, I thought to have things lined up in a treeview. And I have the XML dialog and all the coding up going at the moment. Things categorizes pretty nicely, and it is quite easy to navigate the tree, decide on the title you want, and have the further operation performed from there, once I decide on what to do with the selected title. To give a bit of background, my "baby"-state of the project was done without categories, and just lined up all titles in a listbox. Now, that everything is working, another issue arises, and that is where I was looking for some feedback. When I had things just showing up in a simple listbox, populating this listbox was done in a second or two - even with nearly 1000 entries. As I moved into the tree-structure of my project, I am met with another reality. I can start the dialog, and it will take anything between 2 and 4 minutes for the computer to populate the tree. At the most, I'd say there is 5 levels on the tree. In the root of the tree, you will find approximately 40-50 entries (main categories). I thought maybe something was wrong with my code. so I dropped out the lines of code that inserts the very "leaves" - if you want to name them so - that is, the titles of the albums. In reality, now we only have a treeview, with main categories, subcategories, and artist names. No album titles. In this state, the tree populates in a few seconds. Once I re-insert the lines that populate the last level, that is the album titles, and that is where the big number of entries comes in, things are back to the real slow processing time. For inserting the Album title, I am using the same method as when creating the different branch levels. That is, first to create a TV.NewItem, fill in its Text and Data properties. Next, create an object pointing to the Parent Branch, in my example the Artist name. And, finally, using the Children method to Insert the entry of mine. Dim ArtistName: ArtistName = "Jim Reeves" Dim TVEntry: Set TVEntry = TV.NewItem TVEntry.Text = "Best Of" TVEntry.Data = 198901 Dim TVBranch: Set TVBranch = TV( ArtistName) TVBranch.Children.Insert TVEntry, TVILast This is a simplified snip-it of the code. I have not taken any security steps in this snip-it. What puzzles me, is why it takes so long to populate all the different branches, with all the titles. As I stated, creating a tree with no "leaves", only all the Category an subcategory-branches, took little or no time to populate. And even filling a Listbox - although a far simpler constructed control - did not take an eternity either. Questions for your consideration, would be: - Is a Treeview supposed to be that slow to fill? - Am I overlooking something here, maybe, that could cause this slow processing? I.e, could I have used another method of inserting the last level? - One alternative is, of course, to have all the categories and subcategories show up in a treeview, and when the user have decided on the one he wants to explore, he would tab over to a listbox that contains all the entries in this subcategory. Haven't tried that last approach, and really would have loved not to do it either, if possible. But I cannot afford to leave the user with a several minutes long processing time, just for his collection to be opened on the screen. Worst thing is, that I loose speech while the tree is populated. So seemingly I cannot even ask the user to do other computing while he is awaiting the long processing. I just wondered if the very nature of the tree-structure conrol, is such that it only is an effecient way of displaying a few entries? Sorry for a rather lengthy explanation, but hope it all made a bit of sense. As you may understand from the nature of the project, the individual entries on the tree, are quite dynamic, so will have to insert them on the fly, and cannot hard-code much other than the filling process, and then leave it to the user to make the actual entries. Thanks for any feedback in this regard. -- David _______________________________________________ Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Ai Squared. For membership options, visit http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/corange%40psc.state.fl.us. For subscription options, visit http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com List archives can be found at http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com _______________________________________________ Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Ai Squared. For membership options, visit http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com. For subscription options, visit http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com List archives can be found at http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com