News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How do I speed up this treeview insert?

Started by Gunner, January 07, 2011, 02:26:29 AM

Previous topic - Next topic

Gunner

Thanks everyone for the great tips, they all help speed up the tree loading from my original post!!!!  I have found a faster way..  When I insert a root node, I save the text to a listview item, and the handle to the node in the lparam of the lvitem, next time I go and load an item, instead of looping through ALL the tree nodes (which is where the bottleneck was)  I just do a LVM_FINDITEM and if the item is in the listview, get the lparam and and use that as the parent.   Got the loading down to about 2 and a half seconds for about 6000 items  :clap: 

I have a feeling I could remove the listview and do the same with code only... not sure though!  My quest continues for more speed!
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

Tedd

You can insert only the top-level nodes, and then respond to TVN_ITEMEXPANDING (it's delivered through WM_NOTIFY) and insert the expanded node's children at that point.
This will avoid the extra listview and searching.


TVN_GETDISPINFO isn't quite suitable - it's meant for items that change dynamically, so you can update the text/attributes whenever they're drawn - you'd still need to insert all of the items.
No snowflake in an avalanche feels responsible.

oex

Quote from: Tedd on January 14, 2011, 01:08:34 PM
You can insert only the top-level nodes, and then respond to TVN_ITEMEXPANDING (it's delivered through WM_NOTIFY) and insert the expanded node's children at that point.
This will avoid the extra listview and searching.

This isnt ideal, it is better to add 2 levels so the children are already there otherwise there is a delay on expand.... One level extra should suffice however it is just a pain to manage the items to add.... Long time since I did this in VB and this was easier than in ASM....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.