Board index » delphi » Treeview to TreeView Assign

Treeview to TreeView Assign

Hi,
    I have two TTreviews and I want to assign the nodes of Treeview1 (1500
nodes) to Treeview2 (empty)
I have used the code :
TreeView1.Items.Assign(TreeView2.Items);

I have timed this call by doing the following :
x := gettickcount;
TreeView1.Items.Assign(TreeView2.Items);
y := gettickcount;
showmessage(inttostr(y-x));

Is this a valid way to time a function?
If this is a valid way then it takes 500ms, is there a quicker way of doing
this, as I may have alot more nodes and I the delay is too much.

Thanks
Tom Bradshaw
tom.brads...@zytek.co.uk

 

Re:Treeview to TreeView Assign


Did you try :

  TreeView1.Items.BeginUpdate;
  // ...
  TreeView1.Items.EndUpdate;

?
tom

Tom Bradshaw <tom.brads...@zytek.co.uk> schrieb in im Newsbeitrag:
39db5600$1_2@dnews...

Quote
> Hi,
>     I have two TTreviews and I want to assign the nodes of Treeview1 (1500
> nodes) to Treeview2 (empty)
> I have used the code :
> TreeView1.Items.Assign(TreeView2.Items);

> I have timed this call by doing the following :
> x := gettickcount;
> TreeView1.Items.Assign(TreeView2.Items);
> y := gettickcount;
> showmessage(inttostr(y-x));

> Is this a valid way to time a function?
> If this is a valid way then it takes 500ms, is there a quicker way of
doing
> this, as I may have alot more nodes and I the delay is too much.

> Thanks
> Tom Bradshaw
> tom.brads...@zytek.co.uk

Re:Treeview to TreeView Assign


Try RapidTree (www.imcasys.com/rapid.htm) or FlyTreeView
(www.imcasys.com/flytree.htm).
In one line code you can assign entire tree (with all published properties)
or entire nodes array with impressive speed.

Quote
Tom Bradshaw <tom.brads...@zytek.co.uk> wrote in message

news:39db5600$1_2@dnews...
Quote
> Hi,
>     I have two TTreviews and I want to assign the nodes of Treeview1 (1500
> nodes) to Treeview2 (empty)
> I have used the code :
> TreeView1.Items.Assign(TreeView2.Items);

> I have timed this call by doing the following :
> x := gettickcount;
> TreeView1.Items.Assign(TreeView2.Items);
> y := gettickcount;
> showmessage(inttostr(y-x));

> Is this a valid way to time a function?
> If this is a valid way then it takes 500ms, is there a quicker way of
doing
> this, as I may have alot more nodes and I the delay is too much.

> Thanks
> Tom Bradshaw
> tom.brads...@zytek.co.uk

Other Threads