TMS TAdvTreeView Developers Guide
TMS TAdvTreeView Developers Guide
TMS TAdvTreeView
DEVELOPERS GUIDE
June 2020
Copyright © 2017 - 2020 by tmssoftware.com bvba
Web: https://www.tmssoftware.com
Email: [email protected]
1
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Index
Introduction ................................................................................................. 3
Organization................................................................................................. 4
Modes ........................................................................................................ 5
Virtual ..................................................................................................... 5
Collection-based ......................................................................................... 8
Columns ..................................................................................................... 10
Configuration / Appearance........................................................................... 10
Autosizing and stretching .............................................................................. 12
Groups ...................................................................................................... 16
Configuration ............................................................................................ 16
Appearance .............................................................................................. 17
Nodes ........................................................................................................ 19
Configuration / Appearance........................................................................... 19
Adding, inserting and removing nodes ............................................................... 19
Fixed vs variable node height ......................................................................... 22
Checkbox / Radiobutton support ..................................................................... 27
Extended nodes ......................................................................................... 28
Interaction.................................................................................................. 31
Clipboard ................................................................................................... 32
Reordering / Drag & Drop ................................................................................ 33
Filtering ..................................................................................................... 34
Sorting ...................................................................................................... 37
Editing ...................................................................................................... 37
Custom Editor ........................................................................................... 39
Customization .............................................................................................. 41
Demos ....................................................................................................... 43
Overview ................................................................................................. 43
Directory ................................................................................................. 43
Properties .................................................................................................. 45
Public Properties........................................................................................ 52
Events ....................................................................................................... 55
Procedures and functions ................................................................................ 58
TAdvDirectoryTreeView and TAdvCheckedTreeView ................................................. 66
TMS Mini HTML rendering engine ........................................................................ 66
2
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Introduction
The TMS Advanced TreeView offers a wide range of features to enhance your applications.
- High performance virtual and collection-based mode able to easily deal with millions
of nodes
- Multi-line HTML formatted text
- Various built-in column editors
- Multi-column support
- Fixed and variable node height and node auto sizing
- Multiple events for custom drawing and customization of default drawing
- Multiple events for all kinds of interactions such as editing, expand / collapse and
selection
- Auto-sizing and stretching of columns
- Mouse and keyboard interaction
- Nodes with checkbox, radiobutton, image, disabled nodes
- Nodes extending over multiple columns
- TAdvCheckedTreeView & TAdvDirectoryTreeView
3
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Organization
Below is a quick overview of the most important elements in the TreeView. This guide will
cover all elements in different chapters.
1) Columns / Column groups, which are added through the Columns / Groups collection.
Columns based settings can override the default appearance for nodes. Via Columns a
header and configure text alignment, wordwrapping and appearance can be specified.
2) Nodes: Holds a set of values such as the text, icon and check state that are
represented in each column. Nodes can have child nodes and when child nodes are
added, an expand/collapse icon is shown.
3) HTML formatted text: The node can display HTML formatted text for each column.
Simply add the supported HTML tags and the TreeView will automatically switch to
HTML.
5) Customization: Each element in the TreeView can be fully customized. In the above
sample a progressbar is drawn to indicate a certain level of stock instead of text.
4
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Modes
The TreeView supports a collection-based and a virtual mode. Both modes will be explained
in this chapter together with a small sample. You will notice that each programmatic call to
manipulate / interact with nodes has a virtual and a collection-based version of the node.
By default a collection-based TreeView is used. Below is a screenshot on how a default
TAdvTreeView instance looks like when dropped on the form.
Virtual
The TreeView will retrieve its values for each column and the number of nodes/child nodes
through events. Each event that retrieves the node values passes an ANode parameter of type
TAdvTreeViewVirtualNode. The most important event to start with is the
OnGetNumberOfNodes event. This event retrieves the number of nodes during creation of the
TreeView. The event is also called for child nodes after successfully retrieving the child count
for each node. The first level of nodes is -1 (under root) which is the initial display of nodes
and can be accessed with the ANode parameter in the OnGetNumberOfNodes event. Below is
a sample that demonstrates this.
5
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
ANumberOfNodes := 10;
end;
Note that this sample code is executed on a default TAdvTreeView instance dropped on the
form without any properties changed. As you will notice, the default columns are still used
while the nodes (i.e. default collection based) are removed.
When continuing with our virtual mode based TreeView you will notice that the text of the
nodes is missing. To further define the setup of the TreeView, we will remove the default
columns and add new columns to the TreeView. Additionally we will specify text for each
node through the OnGetNodeText event.
AdvTreeView1.BeginUpdate;
AdvTreeView1.Columns.Clear;
AdvTreeView1.Columns.Add.Text := 'Column 1';
AdvTreeView1.Columns.Add.Text := 'Column 2';
AdvTreeView1.EndUpdate;
6
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
To add child nodes for each node the level of the nodes is identified with the level property
on the ANode parameter. Note from the first sample that the level is -1 for the root nodes.
For all root child nodes that are added the level is 0 or larger. Each node has an Index
parameter and a Row parameter to uniquely identify each node. The following sample adds 3
root nodes and adds 5 child nodes for the first root node.
7
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Each property that affects the node text, icon, check state, … can be configured through the
OnGetNode* events. Alternatively a collection-based approach can be used which is explained
below. When using a virtual TreeView all virtual procedures, functions and properties need to
be used. Below is a sample that expands all nodes in a virtual TreeView.
AdvTreeView1.ExpandAllVirtual;
Collection-based
A collection-based TreeView uses nodes from the Nodes collection property. Each node
represents a set of values for each column that can be accessed through the Values property.
Below is the same sample as in the Virtual mode, but then created through the Nodes
collection.
var
I: Integer;
C: Integer;
K: Integer;
pn: TAdvTreeViewNode;
begin
AdvTreeView1.BeginUpdate;
AdvTreeView1.ClearColumns;
AdvTreeView1.ClearNodes;
AdvTreeView1.Columns.Add.Text := 'Column 1';
AdvTreeView1.Columns.Add.Text := 'Column 2';
for I := 0 to 2 do
8
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
begin
pn := AdvTreeView1.AddNode;
for C := 0 to AdvTreeView1.Columns.Count - 1 do
pn.Text[C] := 'Node ' + inttostr(I) + ' for ' +
AdvTreeView1.Columns[C].Text;
if I = 0 then
begin
for K := 0 to 4 do
begin
childn := AdvTreeView1.AddNode(pn);
for C := 0 to AdvTreeView1.Columns.Count - 1 do
childn.Text[C] := 'Child Node ' + inttostr(K);
end;
end;
end;
AdvTreeView1.EndUpdate;
end;
When using a collection-based TreeView the information of each node such as the position,
height, level, ... is stored in the TAdvTreeViewVirtualNode object which is the same object
being used in the virtual mode. Each collection-based node has a reference to the virtual
node through the VirtualNode property. When using a collection-based TreeView the non-
virtual procedures / functions an properties need to be used. Below is a sample that expands
all nodes in a collection-based TreeView.
AdvTreeView1.ExpandAll;
9
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Columns
Configuration / Appearance
The columns are configured through the Columns collection. Each column displays a set of
values for each node such as the text, icon and check state. The most important property for
a column is the UseDefaultAppearance property which is used to switch between the
properties set at ColumnsAppearance level or the properties on the column collection item
level for controlling the appearance of a column. Per column, horizontal, vertical text
alignment as well as trimming and word wrapping can be configured. Fine-tuning is possible
through a variety of events. Below is a sample that explains the difference between using the
default appearance and customizing the appearance with the UseDefaultAppearance = false
property per column.
In the following sample, we want to customize the font color and size of the header of the
column and the font color of the nodes. For this we need to set the
ColumnsAppearance.TopFont.Color, the ColumnsAppearance.TopFont and the
NodesAppearance.Font.Color properties. Note that the NodesAppearance covers the nodes
area while the ColumnsAppearance covers the columns area.
var
n: TAdvTreeViewNode;
begin
AdvTreeView1.BeginUpdate;
AdvTreeView1.Nodes.Clear;
AdvTreeView1.Columns.Clear;
AdvTreeView1.ColumnsAppearance.TopFont.Size := 16;
AdvTreeView1.ColumnsAppearance.TopFont.Color := gcOrange;
10
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
AdvTreeView1.NodesAppearance.Font.Color := gcSeagreen;
AdvTreeView1.EndUpdate;
end;
Let’s say we add a third column, and don’t want to take on the default appearance, but
instead use a different color for the header and nodes text and we don’t change the font size.
Additionally we also apply trimming. Below is a sample that demonstrates this.
var
n: TAdvTreeViewNode;
begin
AdvTreeView1.BeginUpdate;
AdvTreeView1.Nodes.Clear;
AdvTreeView1.Columns.Clear;
n := AdvTreeView1.AddNode;
n.Text[0] := 'Node 0 for Column 1';
n.Text[1] := 'Node 0 for Column 2';
n.Text[2] := 'Node 0 for Column 3';
n := AdvTreeView1.AddNode;
n.Text[0] := 'Node 1 for Column 1';
n.Text[1] := 'Node 1 for Column 2';
n.Text[2] := 'Node 1 for Column 3';
n := AdvTreeView1.AddNode;
n.Text[0] := 'Node 2 for Column 1';
n.Text[1] := 'Node 2 for Column 2';
n.Text[2] := 'Node 2 for Column 3';
11
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
AdvTreeView1.ColumnsAppearance.TopFont.Color := gcOrange;
AdvTreeView1.ColumnsAppearance.TopFont.Size := 16;
AdvTreeView1.NodesAppearance.Font.Color := gcSeagreen;
AdvTreeView1.EndUpdate;
end;
As you will notice, the default font color for both the header and the nodes is gray which can
be set on column level with the properties Column[Index].TopFont.Color and
Column[Index].Font.Color. The following sample adds 2 additional lines to the previous
sample to configure this.
AdvTreeView1.Columns[2].TopFont.Color := clRed;
AdvTreeView1.Columns[2].Font.Color := clPurple;
When dropping a TreeView instance on the form, you will notice that it already has three
columns and has default behavior of stretching those columns to fit the width of the control.
The TreeView exposes the ability to stretch all columns, or a specific column. When turning
off stretching completely each column has its own Width property that can be used to set a
fixed width for a column.
Below is a sample of the default TreeView and a sample after the width of the TreeView has
been changed.
default
12
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
width changed
As explained, the default behavior of the columns is to stretch. Below is a sample that turns
off stretching for all columns except for a specific column and instead automatically uses the
leftover width.
AdvTreeView1.ColumnsAppearance.StretchAll := False;
AdvTreeView1.ColumnsAppearance.StretchColumn := 1;
13
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Turning off stretching completely with the Stretch property will allow the TreeView to fall
back on the width property of each column which is 100 by default.
AdvTreeView1.ColumnsAppearance.Stretch := False;
Autosizing can be done only when the Stretch property is set to false. The ability is included
to autosize on double-click on the column header splitter line, but this feature is explained in
the Interaction chapter. When programmatically autosizing the visible nodes, column header
for top and bottom layouts are take into calculation to determine the width for a column.
Below is a sample that applies autosizing on all three columns, after turning off stretching.
14
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
var
I: Integer;
begin
AdvTreeView1.ColumnsAppearance.Stretch := False;
for I := 0 to AdvTreeView1.Columns.Count - 1 do
AdvTreeView1.AutoSizeColumn(I);
end;
Note that autosizing is only applied to the visible nodes, so collapsed nodes and nodes that
fall outside the visible region will not be taken into calculation. To support autosizing on
expand/collapse and scrolling, events can be used to accomplish this.
15
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Groups
Configuration
Groups are used to add additional information to columns. They can be added to multiple
columns or simply cover one column. Below is a sample that adds 2 groups for 3 columns, one
group that is used for the first column and a group that stretches of the last 2 columns.
var
grp: TAdvTreeViewGroup;
begin
grp := AdvTreeView1.Groups.Add;
grp.StartColumn := 0;
grp.EndColumn := 1;
grp.Text := 'Important';
grp := AdvTreeView1.Groups.Add;
grp.StartColumn := 2;
grp.EndColumn := 3;
grp.Text := 'Less Important';
end;
Note that in this case, the additional groups decrease the available space for nodes so a
vertical scrollbar is needed to make sure all nodes are reachable.
16
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Appearance
As with the columns, the groups have their own appearance control. The default appearance
is stored under the GroupsAppearance property and can be overridden with the
UseDefaultAppearance property per group. Below is a sample that demonstrates this.
var
grp: TAdvTreeViewGroup;
begin
AdvTreeView1.BeginUpdate;
grp := AdvTreeView1.Groups.Add;
grp.StartColumn := 0;
grp.EndColumn := 1;
grp.Text := 'Important';
grp := AdvTreeView1.Groups.Add;
grp.StartColumn := 2;
grp.EndColumn := 3;
grp.Text := 'Less Important';
grp.UseDefaultAppearance := False;
grp.TopFill.Color := clRed;
grp.TopFill.Kind := tvbkSolid;
grp.TopFont.Color := clWhite;
AdvTreeView1.GroupsAppearance.TopFont.Size := 16;
AdvTreeView1.GroupsAppearance.TopFont.Style := [fsBold];
AdvTreeView1.GroupsAppearance.TopFont.Color := gcSeagreen;
AdvTreeView1.EndUpdate;
end;
17
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
18
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Nodes
Configuration / Appearance
Nodes are the core data structure for the TreeView and as already explained in the Modes
chapter, the TreeView can use a collection-based and virtual mode for displaying nodes. The
virtual mode always starts by implementing the OnGetNumberOfNodes event and the
collection-based mode starts with the Nodes collection property. Each collection-based node
automatically generates a virtual node to hold the most important information such as the
Index, Row, Level, Children and TotalChildren. For each event that is triggered, the virtual
node is passed as a parameter, because when using only a virtual based TreeView, the values
represented in each column need to be returned through events. When a collection-based
TreeView is used, and events need to be implemented, each virtual node holds a reference to
the collection item node (TAdvTreeViewVirtualNode.Node) that is used and vice versa
(TAdvTreeViewNode.VirtualNode). Only when using a virtual TreeView the
TAdvTreeViewVirtualNode .Node property will be nil.
Important to know is that each procedure, function and property has a collection-based and a
virtual implementation. Generally, the procedures, functions and properties without virtual in
the name are used for a collection-based TreeView.
Adding, inserting and removing nodes are supported in both collection-based and virtual
mode. As already explained, each mode has its own procedures, methods and events. In this
chapter we start with an empty TreeView, so all nodes are removed from the collection which
are added at designtime. Both collection-based and virtual add, insert and remove node
methods will be explained here.
Each TreeView, whether it’s collection-based or virtual will start without nodes and with a
single column. The code to accomplish this is demonstrated below.
AdvTreeView1.BeginUpdate;
AdvTreeView1.ClearColumns;
AdvTreeView1.ClearNodes;
19
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Additionally for the virtual TreeView implementation the OnGetNumberOfNodes always needs
to be implemented and return at least one node. With virtual mode the text is empty by
default, so the OnGetNodeText event needs to be implemented as well. The code below
demonstrates this. Please note that the code below is only added in case a virtual TreeView
mode is chosen.
A new node is added with the code AdvTreeView1.AddVirtualNode;. Note that the
OnGetNodeText will be called returning a different text for the newly added node.
In a collection-based TreeView, a node is added directly to the Nodes collection, or with the
helper method AdvTreeView1.AddNode;. To get the same result as with the virtual
implementation, we need to add 2 nodes, because in the virtual mode, the first node was
added through the OnGetNumberOfNodes, which isn’t used in a collection-based TreeView.
20
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Child nodes can be added with the same function, but instead passing the parent node as a
parameter. The following sample demonstrates how to add a child node to the second root
node added with the AddVirtualNode method. Additionally, the parent node that is added
together with the child node is expanded to visually the newly added child node.
var
pn, n: TAdvTreeViewVirtualNode;
begin
pn := AdvTreeView1.AddVirtualNode;
n := AdvTreeView1.AddVirtualNode(pn);
AdvTreeView1.ExpandVirtualNode(pn);
end;
Child nodes can be added the same way as in the virtual mode, but with different method
names. When we copy the above code and remove the Virtual keyword in the method name,
the result output will be identical if we keep in mind that an additional node needs to be
added in the collection to match the virtual node added with the OnGetNumberOfNodes.
var
pn, n: TAdvTreeViewNode;
begin
pn := AdvTreeView1.AddNode;
pn.Text[0] := 'Node 0';
pn := AdvTreeView1.AddNode;
pn.Text[0] := 'Node 1';
n := AdvTreeView1.AddNode(pn);
n.Text[0] := 'Node 0';
AdvTreeView1.ExpandNode(pn);
21
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
end;
Inserting nodes is done in the same way as adding nodes, but an additional parameter can be
passed specifying the insert position of the new node. In virtual mode, there isn’t any
difference between inserting and adding new nodes because the OnGetNodeText will return
text based on the index of the node.
Additionally, in a collection-based TreeView, the index parameter of the collection item node
can be used to switch positions with an already existing node, creating a move node
functionality.
Removing an existing node can be done with the RemoveVirtualNode method. The parameter
to pass is an existing node. The following sample retrieves the focused node and removes it.
AdvTreeView1.RemoveVirtualNode(AdvTreeView1.FocusedVirtualNode);
In a collection-based TreeView, removing a node can be done in a similar way but without the
Virtual keyword in the method name. Additionally a node can also be removed by freeing the
collection item. Below code output is identical and removes the focused node on both cases.
AdvTreeView1.RemoveNode(AdvTreeView1.FocusedNode);
AdvTreeView1.FocusedNode.Free;
22
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
A key feature of the TreeView in both collection-based and virtual mode is support for fixed
and variable node height. The simplest configuration is the fixed node height where each
node has the same height, based on the NodesAppearance.FixedHeight property. Word
wrapping the text of a node or specifying a node icon will be based on the fixed height and
thus exceeding the node bounds when the height of the text or the node icon is larger than
the fixed height.
Fixed
AdvTreeView1.BeginUpdate;
AdvTreeView1.ClearNodes;
AdvTreeView1.ClearColumns;
AdvTreeView1.Columns.Add.Text := 'Fixed TreeView';
AdvTreeView1.EndUpdate;
AIcon :=
PictureContainer1.Items[Random(PictureContainer1.Items.Count)].Picture
;
end;
Note that the icons specified through the OnGetNodeIcon event are too large to fit inside the
fixed node height. The solution can be to specify a larger fixed height through the
NodesAppearance.FixedHeight property, but when the values that need to be loaded are
unknown, the fixed height approach is no longer valid. When switching to a variable row
height mode you will notice that the node height will automatically take on the size of the
icons.
AdvTreeView1.BeginUpdate;
AdvTreeView1.NodesAppearance.HeightMode := tnhmVariable;
AdvTreeView1.ClearNodes;
AdvTreeView1.ClearColumns;
AdvTreeView1.Columns.Add.Text := 'Variable TreeView';
AdvTreeView1.EndUpdate;
24
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
In case the text is larger than the node icon, the node height will automatically adapt as
shown in the sample below.
AdvTreeView1.BeginUpdate;
AdvTreeView1.NodesAppearance.HeightMode := tnhmVariable;
AdvTreeView1.ClearNodes;
AdvTreeView1.ClearColumns;
AdvTreeView1.Columns.Add.Text := 'Variable TreeView';
AdvTreeView1.Columns[0].WordWrapping := True;
AdvTreeView1.EndUpdate;
25
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
26
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
When resizing, the node heights will be recalculated, giving more space for the text, and thus
decreasing the necessary height for a node to display all the contents.
The TreeView has radiobutton and checkbox support. When specifying a check type through
the OnGetNodeCheckType event or through the collection-based property CheckTypes at node
level a checkbox or radiobutto will be displayed. More information on interaction will be
explained at the Interaction chapter.
var
n: TAdvTreeViewNode;
I: Integer;
begin
AdvTreeView1.BeginUpdate;
AdvTreeView1.ClearNodes;
AdvTreeView1.ClearColumns;
AdvTreeView1.Columns.Add.Text := 'Checkbox / radiobutton';
for I := 0 to 3 do
begin
n := AdvTreeView1.Nodes.Add;
n.Text[0] := 'CheckBox ' + IntToStr(I);
n.CheckTypes[0] := tvntCheckBox;
if Odd(I) then
n.Checked[0] := True;
end;
27
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
for I := 0 to 3 do
begin
n := AdvTreeView1.Nodes.Add;
n.Text[0] := 'Radiobutton ' + IntToStr(I);
n.CheckTypes[0] := tvntRadioButton;
if I = 2 then
n.Checked[0] := True;
end;
AdvTreeView1.EndUpdate;
end;
Extended nodes
Extended nodes are nodes that are stretched over all columns and takes on the text of the
first column. It is also styled with a different set of properties under NodesAppearance. An
extended node is not editable and selectable by default. This behavior can be overriden in
the Interaction property. To create an extended node, set the Extended property to true on a
collection-based TreeView collection item node, or return True in the OnIsNodeExtended
event. Below is a sample that demonstrates this.
var
n, pn: TAdvTreeViewNode;
I: Integer;
begin
28
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
AdvTreeView1.BeginUpdate;
AdvTreeView1.ClearNodes;
AdvTreeView1.ClearColumns;
AdvTreeView1.Columns.Add.Text := 'Column 1';
AdvTreeView1.Columns.Add.Text := 'Column 2';
pn := AdvTreeView1.Nodes.Add;
pn.Text[0] := 'Normal Node';
pn := AdvTreeView1.Nodes.Add;
pn.Text[0] := 'Extended Node';
pn.Extended := True;
for I := 0 to 3 do
begin
n := AdvTreeView1.AddNode(pn);
if I = 1 then
begin
n.Text[0] := 'Extended Node ' + IntToStr(I);
n.Extended := True;
end
else
begin
n.Text[0] := 'Normal Node Column 1 ' + IntToStr(I);
n.Text[1] := 'Normal Node Column 2 ' + IntToStr(I);
end;
end;
AdvTreeView1.EndUpdate;
end;
29
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
30
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Interaction
The TreeView supports interaction through mouse and keyboard. When clicking on a node that
is selectable, the node is selected. When navigating with the keys up, down, home, end, page
up or page down the selected node will be changed. Extended / disabled nodes are not
selectable by default. The behaviour can be changed by changing the ExtendedSelectable and
ExtendedEditable properties.
When the property MultiSelect is true, multiple nodes can be selected with the CTRL and
SHIFT key with either the mouse or keyboard. The selected nodes can be retrieved with the
SelectedNodeCount function and SelectedNodes property. Selection of nodes can be done
with the SelectNode or SelectNodes method. The SelectNodes method takes an array of
nodes. The above methods apply to a collection-based TreeView, but the same methods with
the virtual method name are available for the virtual TreeView implementation.
When a node has children the left / right keys can expand or collapse the node and visualize
or hide the children. Clicking on the expand / collapse node icon with the left mouse button
will perform the same operation.
The keyboard and mouse can be used to edit the node text for each column when the column
is configured to support editing. Additionally, when typing alphanumeric characters, the
treeview will optionally search for the node that matches the lookup string and navigate to
that node. To enable this feature, you need to set the Interaction.Lookup.Enabled property to
true.
31
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Clipboard
Cut, Copy and Paste is supported when setting the Interaction.ClipboardMode property to
tcmTextOnly or tcmFull. The tcmTextOnly value only copies the text for each column and
does not copy along other attributes such as the check and extended state, the node icon.
The tcmFull clipboard mode copies all attributes of the node. Cut will first copy the node and
then remove it from the treeview. When pasting, the focused node will act as the parent, if
there is no node active the treeview will add the pasted node as a new node in the treeview.
There are additional events that are triggered when performing a cut, copy or paste action.
32
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
When setting Interaction.Reorder to True, clicking on an already selected node will duplicate
the node and attach it while dragging. When releasing the node over another node on the
same level it will reorder the node the new location. Please note that touch scrolling is
disabled when reordering is true on the selected node part. On the non-selected node parts,
touch scrolling is still active.
33
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Filtering
After filtering, the node that matches the chosen filter is shown.
34
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
To clear filtering on a column, click the ‘(All)’ entry in the filter list.
Note that filtering is also available programmatically. Below is a sample that filtes the nodes
with an A:
var
f: TAdvTreeViewFilterData;
begin
AdvTreeView1.Filter.Clear;
f := AdvTreeView1.Filter.Add;
f.Column := 0;
f.Condition := '*A*';
AdvTreeView1.ApplyFilter;
end;
var
f: TAdvTreeViewFilterData;
begin
AdvTreeView1.Filter.Clear;
f := AdvTreeView1.Filter.Add;
f.Column := 0;
f.Condition := '*A*';
f := AdvTreeView1.Filter.Add;
f.Column := 1;
35
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
To clear all filtering programmatically, you can use the following code:
AdvTreeView1.RemoveFilters;
Note that if a child node matches a filter condition, the parent tree is also added.
36
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Sorting
Sorting can be performed on each column separately. When clicking on the column, the nodes
are sorted and the treeview is updated. Sorting can be done for root nodes only, or recursive
with an optional case sensitivity requirement. Below is a sample that sorts based on all nodes
(recursive).
AdvTreeView1.Columns[0].Sorting := tcsRecursive;
Sorting can also be done programmatically, with the following code, which will show the same
result as the screenshot above.
Editing
The TreeView supports inplace editing of nodes per column. Each column has the ability to
specify an editor through the EditorType property. When editing is started, either by clicking
on the text, or by pressing F2 on the keyboard the OnGetNodeText event is called to retrieve
the text that needs to be placed inside the editor. To know if the OnGetNodeText event is
called for drawing/calculation or for editing the AMode parameter can be used. If the
OnGetNodeText event isn’t used to return a different text when editing, the text of the node
is used.
37
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Below is a sample that demonstrates this. (Note that the code above is applied on a default
TreeView instance)
AdvTreeView1.Columns[2].EditorType := tcetEdit;
When the editing is started, the OnGetNodeText event is called with a different mode. To
initialize the editor with a different text the following code provides a sample to achieve this.
After editing is finished, the OnBeforeUpdateNode is called to allow making changes to the
edited text or block updating the node if necessary. Additionally the OnCloseInplaceEditor
event can be used to stop the editor from closing if the requirements of the text are not met.
Note that when editing is allowed on multiple columns, starting to edit a node will always
start with the first not read-only column and then the tab key will jump to the next editable
column.
Other than the default TEdit editor, a TMemo or TComboBox can be chosen to allow editing.
A TMemo is typically used to allow a multi-line editor and a TComboBox to have a choice
menu in case multiple values are possible. A sample that shows how to use the TComboBox as
an inplace editor is shown in the sample below.
var
38
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
I: Integer;
begin
AdvTreeView1.Columns[1].EditorType := tcetComboBox;
for I := 0 to 19 do
AdvTreeView1.Columns[1].EditorItems.Add(IntToStr(2000 + I));
end;
If the built-in editors are not sufficient, the TreeView supports using a custom editor as well,
by setting the CustomEditor property to true.
Custom Editor
The code below demonstrates how to use a custom editor, in this case a TTrackBar.
AdvTreeView1.Columns[1].CustomEditor := True;
39
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
After changing the value, the OnBeforeUpdateNode event is triggered which sets the value of
the node text to the value of the trackbar.
40
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Customization
The TreeView supports a wide range of customization possibilities. Below is a sample how to
implement the correct events for custom node drawing. Note that this sample starts from a
default TreeView with nodes already added to the collection.
In the sample below the second column contains information on the build year of the car. To
identify cars that are built in 2012 or later we want to draw a red ellipse in the top right
corner of the text area for the year column.
41
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
42
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Demos
Overview
The overview demo demonstrates variable node heights, programmatically expand and
collapse as well as custom column appearance and toggling column visibility. The node text in
the description column is HTML formatted and a progressbar is custom drawn inside the stock
column. The last 2 columns amount and delivery method show the capabilities of editing
through TEdit and TComboBox.
Directory
43
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
The Directory treeview demo uses the TAdvDirectoryTreeView component that is capable of
loading a drive, or a folder and apply a filter. Additionally the column sizing, auto sizing of
columns and stretching is demonstrated.
44
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Properties
45
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
tclTop.
Columns[Index] → Trimming The trimming of nodes of a column.
Columns[Index] → UseDefaultAppearance Allows overriding the default
appearance of columns/nodes.
Columns[Index] → VerticalTextAlign The vertical text alignment of nodes.
Columns[Index] → Visible Sets the column visible / invisible.
Columns[Index] → Width The width of the column.
Columns[Index] → WordWrapping The word wrapping of nodes of a
column.
ColumnsAppearance The overall appearance of columns.
Note that these properties are applied
to all columns unless
UseDefaultAppearance is set to False
for a column.
ColumnsAppearance → BottomFill The fill of the column when the
Layout property is set to include
tclBottom.
ColumnsAppearance → BottomFont The font of the column text when the
Layout property is set to include
tclBottom.
ColumnsAppearance → BottomSize The size of the bottom columns.
ColumnsAppearance → BottomStroke The stroke of the column when the
Layout property is set to include
tclBottom.
ColumnsAppearance → BottomVerticalText Allows displaying vertical text in the
columns bottom layout.
ColumnsAppearance → FillEmptySpaces Allows filling empty spaces at the
right side of the columns when the
StretchScrollBars property is set to
False.
ColumnsAppearance → Layouts The layout of the columns which
include tclTop and tclBottom.
ColumnsAppearance → Stretch Allows stretching of columns.
ColumnsAppearance → StretchAll Stretches all columns.
ColumnsAppearance → StretchColumn Calculates all columns except for the
column that matches this property.
The StretchColumn is automatically
given the leftover width after
calculation.
ColumnsAppearance → TopFill The fill of the column when the
46
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
47
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
appearance of groups.
GroupsAppearance The overall appearance of groups.
Note that these properties are applied
to all groups unless
UseDefaultAppearance is set to False
for a group.
GroupsAppearance → BottomFill The fill of the group when the Layout
property is set to include tglBottom.
GroupsAppearance → BottomFont The font of the group text when the
Layout property is set to include
tglBottom.
GroupsAppearance → BottomHorizontalTextAlign The horizontal alignment of the group
text when the Layout property is set
to include tglBottom.
GroupsAppearance → BottomSize The size of the bottom columns.
GroupsAppearance → BottomStroke The stroke of the column when the
Layout property is set to include
tclBottom.
GroupsAppearance → BottomVerticalText Allows displaying vertical text in the
columns bottom layout.
GroupsAppearance → BottomVerticalTextAlign The vertical alignment of the group
text when the Layout property is set
to include tglBottom.
GroupsAppearance → FillEmptySpaces Allows filling empty spaces at the
right side of the columns when the
StretchScrollBars property is set to
False.
GroupsAppearance → Layouts The layout of the groups which
include tglTop and tglBottom.
GroupsAppearance → TopFill The fill of the group when the Layout
property is set to include tglTop.
GroupsAppearance → TopFont The font of the group text when the
Layout property is set to include
tglTop.
GroupsAppearance → TopHorizontalTextAlign The horizontal alignment of the group
text when the Layout property is set
to include tglTop.
GroupsAppearance → TopSize The size of the top columns.
GroupsAppearance → TopStroke The stroke of the column when the
Layout property is set to include
48
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
tglTop.
GroupsAppearance → TopVerticalText Allows displaying vertical text in the
columns top layout.
GroupsAppearance → TopVerticalTextAlign The vertical alignment of the group
text when the Layout property is set
to include tglTop.
Interaction Set of properties for configuring
mouse and keyboard interaction.
Interaction → ClipboardMode Sets the mode for clipboard support.
Interaction → ColumnAutoSizeOnDblClick Allows auto sizing of a column on
double-click. Please note that this will
only apply auto sizing on the visible
nodes.
Interaction → ColumnSizing Allows for column sizing.
Interaction → DragDropMode When true, the treeview supports drag
& drop of nodes.
Interaction → ExtendedEditable Allows extended nodes to be editable.
Interaction → ExtendedSelectable Allows extended nodes to be
selectable.
Interaction → KeyboardEdit Allows keyboard editing when editing
is supported.
Interaction → Lookup When true, the treeview supports
keyboard lookup.
Interaction → MouseEditMode Sets the mouse edit mode when
editing is supported.
Interaction → MultiSelect Allows for multiple node selection
with mouse and keyboard.
Interaction → ReadOnly Sets the TreeView in readonly mode,
which disables node editing on all
columns.
Interaction → Reorder When true, the treeview supports
reordering of nodes.
Interaction → TouchScrolling Allows/disallows touch scrolling. When
True, scrolling can be done by flicking
the mouse (finger) up / down on the
TreeView.
Nodes The nodes collection when a
collection-based TreeView is being
used.
Nodes[Index] → Enabled When False, disables editing and
49
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
selection.
Nodes[Index] → Expanded When True and the node has children,
expands the child nodes. When False,
collapses the child nodes.
Nodes[Index] → Extended When True, applies the extended
properties under NodesAppearance
and only uses and stretches the first
column text over the number of
columns.
Nodes[Index] → Nodes The child nodes collection.
Nodes[Index] → Values The values collection that is
represented in a column for each
node.
Nodes[Index] → Values[Index] → Checked Sets whether the node value for a
specific column is checked.
Nodes[Index] → Values[Index] → CheckType Specifies the check type of a node
value. The type can be a radiobutton
or a checkbox.
Nodes[Index] → Values[Index] → CollapsedIcon The icon in collapsed state.
Nodes[Index] → Values[Index] → The icon in collapsed state for high
CollapsedIconLarge DPI / retina screens.
Nodes[Index] → Values[Index] → The icon name linked to a
CollapsedIconLargeName PictureContainer in collapsed state for
high DPI / retina screens.
Nodes[Index] → Values[Index] → CollapseIconName The icon name linked to a
PicureContainer in collapsed state.
Nodes[Index] → Values[Index] → ExpandedIcon The icon in expanded state.
Nodes[Index] → Values[Index] → The icon in expanded state for high
ExpandedIconLarge DPI / retina screens.
Nodes[Index] → Values[Index] → The icon name linked to a
ExpandedIconLargeName PictureContainer in expanded state
for high DPI / retina screens.
Nodes[Index] → Values[Index] → The icon name linked to a
ExpandedIconName PictureContainer in expanded state.
Nodes[Index] → Values[Index] → Text The Text of a node.
NodesAppearance The appearance for each node.
NodesAppearance → CollapseNodeIcon The icon for the ExpandColumn in
collapsed state.
NodesAppearance → CollapseNodeIconLarge The icon for the ExpandColumn in
collapsed state for high DPI / retina
50
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
screens.
NodesAppearance → ColumnStroke The stroke between columns.
NodesAppearance → DisabledFill The fill of a node in disabled state.
NodesAppearance → DisabledStroke The stroke of a node in disabled state.
NodesAppearance → ExpandColumn The column that shows the expand /
collapse node icons and is used to
expand / collapse the nodes.
NodesAppearance → ExpandHeight The height of the expand / collapse
node icon area.
NodesAppearance → ExpandNodeIcon The icon for the ExpandColumn in
expanded state.
NodesAppearance → ExpandNodeIconLarge The icon for the ExpandColumn in
expanded state.
NodesAppearance → ExpandWidth The width of the expand / collapse
node icon area.
NodesAppearance → ExtendedDisabledFill The fill of an extended node in
disabled state.
NodesAppearance → ExtendedDisabledStroke The stroke of an extended node in
disabled state.
NodesAppearance → ExtendedFill The fill of an extended node.
NodesAppearance → ExtendedFont The font of an extended node.
NodesAppearance → ExtendedSelectedFill The fill of an extended node in
selected state.
NodesAppearance → ExtendedSelectedStroke The stroke of an extended node in
selected state.
NodesAppearance → ExtendedStroke The stroke of an extended node.
NodesAppearance → Fill The fill of a node in normal state.
NodesAppearance → FixedHeight The height of each node in case the
HeightMode property is set to
tnhmFixed.
NodesAppearance → Font The font of a node.
NodesAppearance → HeightMode The HeightMode of the nodes. In case
the HeightMode property is set to
tnhmFixed, the FixedHeight property
is used to determine a fixed height for
each node. When the HeightMode
property is set to tnhmVariable, the
minimum height of a node is 25 and
depending on the text calculation and
properties such as wordwrapping /
51
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Public Properties
TreeView
52
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Node (Virtual)
Important notice: When using one of the array properties, the length of the array will always
be the same as the column count, yet the values that are included will only be valid if the
width & height are larger than 0. When using one of those array properties for custom
drawing keep in mind that drawing is only valid when the above criteria is met.
Node (Collection-Based)
be a radiobutton or a checkbox.
CollapsedIconNames[AColumn: Integer The name of the icon in collapsed state of a
ALarge: Boolean]: String node for a specific column.
CollapsedIcons[AColumn: Integer The icon in collapsed state of a node for a
ALarge: Boolean]: specific column.
TAdvTreeViewBitmap
ExpandedIconNames[AColumn: Integer The name of the icon in expanded state of a
ALarge: Boolean]: String node for a specific column.
ExpandedIcons[AColumn: Integer The icon in expanded state of a node for a
ALarge: Boolean]: specific column.
TAdvTreeViewBitmap
Text[AColumn: Integer]: String The text of a node for a specific column.
VirtualNode: A reference to the virtual node.
TAdvTreeViewVirtualNode
54
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Events
Note that for each event, the TAdvTreeViewVirtualNode is being passed as a parameter. This
class is used in virtual mode and in collection-based mode but has a property Node to easily
access the collection item in case a collection-based TreeView is used.
55
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
56
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
57
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
a node.
Event called to get the vertical text alignment
OnGetNodeVerticalTextAlign of a node.
Event called to get the word wrapping of the
OnGetNodeWordWrapping text of a node.
OnGetNumberOfNodes Event called to get the number of nodes.
Event called when the TreeView scrolls
OnHScroll horizontally.
Event called to determine if a node is checked
OnIsNodeChecked or not.
Event called to determine if a node is enabled
OnIsNodeEnabled or not.
Event called to determine if a node is
OnIsNodeExpanded expanded or not.
Event called to determine if a node is
OnIsNodeExtended extended or not.
Event triggered when applying a column filter
operation. In this event you can additionally
change or add values you wish to see in the
OnNeedFilterDropDownData dropdown window.
Event called when an anchor is clicked in the
OnNodeAnchorClick HTML formatted text of a node.
Event called when the node is changed after
OnNodeChanged editing.
OnNodeClick Event called when a node is clicked.
OnNodeDblClick Event called when a node is double clicked.
Event called when the TreeView scrolls
OnVScroll vertically.
TreeView
58
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
59
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
TAdvTreeViewNode): (collection-based).
TAdvTreeViewNode
GetFirstChildVirtualNode(ANode: Returns the first child node of a node (virtual).
TAdvTreeViewVirtualNode):
TAdvTreeViewVirtualNode
GetFirstRootNode: TAdvTreeViewNode Returns the first root node (collection-based).
GetFirstRootVirtualNode: Returns the first root node (virtual).
TAdvTreeViewVirtualNode
GetHorizontalScrollPosition: Double Returns the horizontal scroll position.
Returns the inplace editor when active. The
GetInplaceEditor: GetInplaceEditor function will return nil when
TAdvTreeViewInplaceEditor the editor is not active.
GetLastChildNode(ANode: Returns the last child node of a node
TAdvTreeViewNode): (collection-based).
TAdvTreeViewNode
GetLastChildVirtualNode(ANode: Returns the last child node of a node (virtual).
TAdvTreeViewVirtualNode):
TAdvTreeViewVirtualNode
GetLastNode: TAdvTreeViewNode Returns the last node (collection-based).
GetLastRootNode: TAdvTreeViewNode Returns the last root node (collection-based).
GetLastRootVirtualNode: Returns the last root node (virtual).
TAdvTreeViewVirtualNode
GetLastVirtualNode: Returns the last node (virtual).
TAdvTreeViewVirtualNode
GetNextChildNode(ANode: Returns the next child node starting from a
TAdvTreeViewNode; AStartNode: parent node and the previous node (collection-
TAdvTreeViewNode): based).
TAdvTreeViewNode
GetNextChildVirtualNode(ANode: Returns the next child node starting from a
TAdvTreeViewVirtualNode; parent node and the previous node (virtual).
AStartNode:
TAdvTreeViewVirtualNode):
TAdvTreeViewVirtualNode
GetNextNode(ANode: Returns the next node starting from a node
TAdvTreeViewNode): (collection-based).
TAdvTreeViewNode
GetNextSiblingNode(ANode: Returns the next sibling node starting from a
TAdvTreeViewNode): node (collection-based).
TAdvTreeViewNode
GetNextSiblingVirtualNode(ANode: Returns the next sibling node starting from a
TAdvTreeViewVirtualNode): node (virtual).
60
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
TAdvTreeViewVirtualNode
GetNextVirtualNode(ANode: Returns the next node starting from the
TAdvTreeViewVirtualNode): previous node (virtual).
TAdvTreeViewVirtualNode
GetNodeChildCount(ANode: Returns the child count for a specific node
TAdvTreeViewNode): Integer (collection-based).
GetParentNode(ANode: Returns the parent node for a specific node
TAdvTreeViewNode): (collection-based).
TAdvTreeViewNode
GetParentVirtualNode(ANode: Returns the parent node for a specific node
TAdvTreeViewVirtualNode): (virtual).
TAdvTreeViewVirtualNode
GetPreviousChildNode(ANode: Returns the previous child node starting from a
TAdvTreeViewNode; AStartNode: parent node and the previous node (collection-
TAdvTreeViewNode): based).
TAdvTreeViewNode
GetPreviousChildVirtualNode(ANode: Returns the previous child node starting from a
TAdvTreeViewVirtualNode; parent node and the previous node (virtual).
AStartNode:
TAdvTreeViewVirtualNode):
TAdvTreeViewVirtualNode
GetPreviousNode(ANode: Returns the previous node starting from a node
TAdvTreeViewNode): (collection-based).
TAdvTreeViewNode
GetPreviousSiblingNode(ANode: Returns the previous sibling starting from a
TAdvTreeViewNode): node (collection-based).
TAdvTreeViewNode
GetPreviousSiblingVirtualNode(ANode: Returns the previous sibling starting from a
TAdvTreeViewVirtualNode): node (virtual).
TAdvTreeViewVirtualNode
GetPreviousVirtualNode(ANode: Returns the previous node starting from a node
TAdvTreeViewVirtualNode): (virtual).
TAdvTreeViewVirtualNode
GetRootNodeByIndex(AIndex: Integer): Returns a root node by a specific index
TAdvTreeViewNode (collection-based).
GetRootVirtualNodeByIndex(AIndex: Returns a root node by a specific index
Integer): TAdvTreeViewVirtualNode (virtual).
GetTotalColumnWidth: Double Returns the total column width.
GetTotalRowHeight: Double Returns the total row height.
GetVerticalScrollPosition: Double Returns the vertical scroll position.
61
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
62
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
AScrollIfNotVisible: Boolean = False; visible, and the scroll position when the node
AScrollPosition: is found (virtual).
TAdvTreeViewNodeScrollPosition =
tvnspTop)
SelectAllNodes Selects all nodes (collection-based).
SelectAllVirtualNodes Selects alls nodes (virtual).
SelectedNodeCount: Integer Selected node count (collection-based).
SelectedVirtualNodeCount: Integer Selected node count (virtual).
SelectNode(ANode: Selects a specific node (collection-based).
TAdvTreeViewNode)
SelectNodes(ANodes: Selects an array of nodes (collection-based).
TAdvTreeViewNodeArray)
SelectVirtualNode(ANode: Selects a specific node (virtual).
TAdvTreeViewVirtualNode)
SelectVirtualNodes(ANodes: Selects an array of nodes (virtual).
TAdvTreeViewVirtualNodeArray)
StopEditing Stops editing.
ToggleCheckNode(ANode: Toggles the state of a checkbox or radiobutton
TAdvTreeViewNode; AColumn: when used in a node column (collection-
Integer; ARecurse: Boolean = False) based).
ToggleCheckVirtualNode(ANode: Toggles the state of a checkbox or radiobutton
TAdvTreeViewVirtualNode; AColumn: when used in a node column (virtual).
Integer; ARecurse: Boolean = False)
ToggleVirtualNode(ANode: Toggles the expand/collapse state of a node
TAdvTreeViewVirtualNode; ARecurse: (virtual).
Boolean = False)
UnCheckNode(ANode: Unchecks a node (collection-based).
TAdvTreeViewNode; AColumn:
Integer; ARecurse: Boolean = False)
UnCheckVirtualNode(ANode: Unchecks a node (virtual).
TAdvTreeViewVirtualNode; AColumn:
Integer; ARecurse: Boolean = False)
UnSelectAllNodes Unselects all nodes (collection-based).
UnSelectAllVirtualNodes Unselects all nodes (virtual).
UnSelectNode(ANode: Unselects a specific node (collection-based).
TAdvTreeViewNode)
UnSelectNodes(ANodes: Unselects an array of nodes (collection-based).
TAdvTreeViewNodeArray)
UnSelectVirtualNode(ANode: Unselects a specific node (virtual).
TAdvTreeViewVirtualNode)
UnSelectVirtualNodes(ANodes: Unselects an array of nodes (virtual).
TAdvTreeViewVirtualNodeArray)
VerticalScrollBar: TScrollBar Returns the vertical scrollbar.
XYToColumnSize(X, Y: Single): Integer Returns a column index at a specific X and Y
63
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
coordinate.
XYToNode(X, Y: Double): Returns a node at a specific X and Y coordinate
TAdvTreeViewVirtualNode (virtual).
XYToNodeAnchor(ANode: Returns a node anchor at a specific X and Y
TAdvTreeViewVirtualNode; X, Y: coordinate.
Single): TAdvTreeViewNodeAnchor
XYToNodeCheck(ANode: Returns a node checkbox or radiobutton area
TAdvTreeViewVirtualNode; X, Y: at a specific X and Y coordinate.
Single): TAdvTreeViewNodeCheck
XYToNodeExpand(ANode: Returns a node expand / collapse area at a
TAdvTreeViewVirtualNode; X, Y: specific X and Y coordinate.
Single): Boolean
XYToNodeTextColumn(ANode: Returns the column of the text of a specific
TAdvTreeViewVirtualNode; X, Y: node at a specific X and Y coordinate.
Single): Integer
Node (Virtual)
Node (Collection-Based)
64
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
65
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
TAdvDirectoryTreeView
The TAdvDirectoryTreeView is capable of displaying drives, folders and files. There are three
important methods to load this information: LoadDrives, LoadDrive and LoadDirectory.
Additionally a filter can be applied for further fine-tuning.
By default there is only one column added which is the name of the file / folder or drive.
When more information is needed, there are additional columns supported such as the
creation date, modification date and the free space, total space in case of a drive. These
columns can be added with the AddColumn function. The directory demo that is included in
the distribution demonstrates this component.
TAdvCheckedTreeView
The TAdvCheckedTreeView adds a checkbox for each node by default. The behaviour is
identical to the TAdvTreeView but saves the code for adding a checkbox to each node.
Another core technology used among many components is a small fast & lightweight HTML
rendering engine. This engine implements a childset of the HTML standard to display
formatted text. It supports following tags :
B : Bold tag
<B> : start bold text
</B> : end bold text
U : Underline tag
<U> : start underlined text
</U> : end underlined text
66
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
I : Italic tag
<I> : start italic text
</I> : end italic text
S : Strikeout tag
<S> : start strike-through text
</S> : end strike-through text
A : anchor tag
<A href="value"> : text after tag is an anchor. The 'value' after the href identifier is the
anchor. This can be an URL (with ftp,http,mailto,file identifier) or any text.
If the value is an URL, the shellexecute function is called, otherwise, the anchor value can be
found in the OnAnchorClick event </A> : end of anchor
P : paragraph
<P align="alignvalue" [bgcolor="colorvalue"] [bgcolorto="colorvalue"]> : starts a new
paragraph, with left, right or center alignment. The paragraph background color is set by the
optional bgcolor parameter. If bgcolor and bgcolorto are specified,
67
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
HR : horizontal line
<HR> : inserts linebreak with horizontal line
BR : linebreak
<BR> : inserts a linebreak
Example :
This will be <IND x="75">indented 75 pixels.
Optionally, an alignment tag can be included. If no alignment is included, the text alignment
with respect to the image is bottom. Other possibilities are: align="top" and align="middle"
68
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
The width & height to render the image can be specified as well. If the image is embedded in
anchor tags, a different image can be displayed when the mouse is in the image area through
the Alt attribute.
Examples :
This is an image <IMG src="name">
UL : list tag
<UL> : start unordered list tag
</UL> : end unordered list
Example : <UL>
<LI>List item 1
<LI>List item 2
<UL>
<LI> Child list item A
<LI> Child list item B
</UL>
<LI>List item 3
</UL>
LI : list item
<LI [type="specifier"] [color="color"] [name="imagename"]>: new list item specifier can be
"square", "circle" or "image" bullet. Color sets the color of the square or circle bullet.
Imagename sets the PictureContainer image name for image to use as bullet
69
TMS SOFTWARE
TMS Advanced TreeView
DEVELOPERS GUIDE
Z : hidden text
<Z> : start hidden text
</Z> : end hidden text
Special characters
Following standard HTML special characters are supported :
< : less than : <
> : greater than : >
& : &
" : "
: non breaking space
™ : trademark symbol
€ : euro symbol
§ : section symbol
© : copyright symbol
¶ : paragraph symbol
70