[DUG] Virtual Tree View

Dennis Chuah dennis_cs_chuah at hotmail.com
Tue Sep 13 19:59:28 NZST 2005


John,

We use virtual tree view extensively, for tree views, as a grid and as a 
property editor.  Contrary to what you might have heard, it is not hard to 
learn.  The only thing that you will need to get your head around is the 
fact that it is virtual, ie., it does not contain any data.  The data 
structures only contain the data hierarchy.  The tree view gets the caption, 
icon, colour, etc. by firing events and you handle those events and provide 
the appropriate information.

Each node on the tree is represented by a record structure - the detail of 
which mostly do not concern the programmer.  On the structure, there is, by 
default, a 4 byte pointer, which you can use to point to the actual data.  
You can tell the tree to extend the structure to store mre data, but IMHO, 
it is better to just use the pointer to reference an object where you would 
store all the data.

The construction of the tree nodes is also dynamic, meaning, the tree will 
ask you to construct the nodes, and it will only ask you for the nodes that 
it needs to display.  For example, if you have a node with child nodes; as 
long as the parent node has not yet been expanded, the child nodes will not 
be created.

By using events to get data to display, you get things like dynamic updating 
of data across multiple trees when the data source has changed pretty much 
for free.

Using the events is really easy.  For example, the event to get the text of 
a node will pass as a parameter, a reference to the node's record structure. 
  You would then use this to dreference your object and return the text that 
should be displayed on the tree.

HTH,
Dennis.

>From: "John Bird" <johnkbird at paradise.net.nz>
>Date: Tue, 13 Sep 2005 16:16:19 +1200
>
>Anyone got references other than the Web Site for reading/manual stuff for
>Virtual Tree View..
>Particularly using as a grid.
>
>What it can do looks terrific, found it so far quite hard to learn.
>
>John B
>
>_______________________________________________
>Delphi mailing list
>Delphi at ns3.123.co.nz
>http://ns3.123.co.nz/mailman/listinfo/delphi

_________________________________________________________________
Become a fitness fanatic @  http://xtramsn.co.nz/health



More information about the Delphi mailing list