Re:Link the treenodes item in one treeview to another treeview
U?ytkownik "CJ" <Chris.l.John...@alcatel.com> napisa3 w wiadomo?ci news:3c3602af$1_1@dnews...
Quote
> I am trying to link the contents(ttreenodes) of one treeview to
> another and have the second automatically update when the first
> treeview is modified. I can do this if I constant set:
> treeview1.items:=treeview2.items
> every time treeview1 is modified. This appears to act as a copy
> of some sort [...]
Exactly.
In TCustomTreeView Items is a property fefined as follows:
===========
property Items: TTreeNodes read FTreeNodes write SetTreeNodes;
procedure TCustomTreeView.SetTreeNodes(Value: TTreeNodes);
begin
Items.Assign(Value); {i.e. FTreeNodes.Assign(Value)}
end;
===========
So in your case each TTreeView object maitains its own items.
When you make the assignment the items from on object are
copied to the other (by Assign method) but the pointer itself
remains unchanged.
You can place the assignment in the OnChange event handler,
however this may slow down the program significantly, I'm afraid.
--
Zbigniew Lipinski
z...@webmedia.pl
http://www.webmedia.pl/zl1