Treeview issue: how to INSERT nodes (not ADD them)?

JustAGuy
01-08-2004, 06:43 AM
I am playing around with treeview, but I noticed something sad...
Seems that it just allows to add a new node at the bottom of the tree. Because I need to perform a manual refreshing of the treeview, I use the methods remove and add all the time, and it takes a lot of PC resources.

I would like to know two things:

1) There is a way to insert (this method don't exists) a node in a specific position of treeview, but the bottom?

2) There is a way to scroll treeview, programmatically?

Thanks!

MKoslof
01-08-2004, 07:39 AM
I believe the only way to do something like this is to search for a specific location within a parent or child node. Once you find the location, use the .add command to create a new node at the found position. I don't think there is an easy way to do this. I have seen some neat examples using .net, but nothing substantial for VB.

JustAGuy
01-08-2004, 07:44 AM
Well, I already had tried that, but it not works: even if you find a specific location and select that node, when you perform the add method, the new node is added at the bottom.

Well the way I am doing it currently is remove all nodes from the bottom until the point I want to insert the node, then I insert it, and then put the rest of the nodes again. It works fine, but is satisfactory just when the treeview is short, because in long treeviews it takes a lot of time.

Well, thanks anyway!

MKoslof
01-08-2004, 08:08 AM
hmmm..I might have some code I wrote buried somewhere where I attempted to do this...it has been sometime since I used VB and a tree view..now, If I am creating an App with a treeview I am using .Net or Delphi..the main interfaces we use for database development at work.

If I recall correctly, just like you, I had a lot of trouble doing this. I do think my code did involve looping the current parent node, and adding the node at a set location, but I might have been removing nodes and re-populating as well....

Let me see if I can find it..wish I had some time to build a new test :) right now but I don't :). The method you are currently using might be the best way...but maybe if you made it a function that you called when needed the overall speed would improve slightly.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum