class TreeView
An expandable tree.
Syntax
[<oRef> =] new TreeView(<container> [,<name expC>])
<oRef>
A variable or property—typically of <container>—in which to store a reference to the newly created TreeView object.
<container>
The container—typically a Form object—to which you’re binding the TreeView object.
<name expC>
An optional name for the TreeView object. If not specified, the TreeView class will auto-generate a name for the object.
Properties
The following tables list the properties, events, and methods of interest in the TreeView class.
Property |
Default |
Description |
false |
Whether dragged objects can be dropped on the TreeView | |
true |
Whether the text labels of the tree items are editable | |
true |
Whether items can be added or deleted from the tree | |
0 – None |
How the TreeView object is anchored in its container (0=None, 1=Bottom, 2=Top, 3=Left, 4=Right, 5=Center, 6=Container) | |
TREEVIEW |
Identifies the object as an instance of the TreeView class | |
true |
Whether each tree item has a checkbox | |
|
The image to display when a tree item is checked instead of a checked check box | |
(TREEVIEW) |
Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName | |
WindowText |
The color of the text labels and background | |
false |
Whether the tree view’s popup menu is disabled | |
|
The first child tree item | |
|
The first TreeItem that is visible in the TreeView area | |
true |
Whether + and - icons are displayed for TreeItems that have children | |
true |
Whether lines are drawn between TreeItems | |
|
Default image displayed between checkbox and text label when a TreeItem does not have focus | |
true |
Whether TreeItem images automatically scale to match the text label font height | |
|
The height of TreeItem images in pixels | |
|
The horizontal indent, in pixels, for each level of TreeItems | |
true |
Whether a line connects the TreeItems at the first level | |
|
The currently selected TreeItem | |
|
Default image displayed between CheckBox and TextLabel when a TreeItem has focus | |
true |
Whether to highlight the selected item in the tree even when the TreeView does not have focus | |
true |
Whether to display TextLabels as tooltips if they are too long to display fully in the TreeView area as the mouse passes over them | |
true |
Whether to highlight and underline TreeItems as the mouse passes over them | |
|
The image to display when a TreeItem is not checked instead of an empty check box
| |
Event |
Parameters |
Description |
|
Before selection moves to another TreeItem; return value determines if selection can leave current TreeItem | |
|
When attempting to edit text label; return value determines whether editing is allowed | |
<oItem> |
When attempting to expand or collapse a TreeItem; return value determines whether expand/collapse occurs | |
|
After the selection moves to another TreeItem | |
|
After a checkbox in a TreeItem is clicked |
<left expN> |
When the mouse enters the TreeView display area during a Drag&Drop operation | |
|
When the mouse leaves the TreeView display area without having dropped an object | |
<left expN> |
While the mouse drags an object over the TreeView display area during a Drag&Drop operation | |
<left expN>
|
When the mouse button is released over the TreeView display area during a Drag&Drop operation |
<text expC> |
After the TextLabel in a TreeItem is edited; may optionally return a different label value to save | |
<oItem> |
After a TreeItem is expanded or collapsed
| |
Method |
Parameters |
Description |
|
Returns the total number of TreeItems in the tree | |
<col expN> |
Returns an object reference to a TreeItem object located at a specified position | |
<filename expC> |
Loads and instantiates child TreeItems from a text file | |
|
Deletes all TreeItems in the tree | |
|
Sorts child TreeItems | |
<filename expC> |
Streams child TreeItems out to a text file | |
|
Returns the number of TreeItems visible in the tree view area
|
The following table lists the common properties, events, and methods of the TreeView class:
Description
A TreeView displays a collapsible multi-level tree. There are four ways to create the tree:
Explicitly add items with code, like the code generated by the Form Designer.
Interactively through the TreeView’s runtime user interface (right-clicking or pressing certain keys).
Data-driven code that reads a table and dynamically creates the tree items.
Use the TreeView's loadChildren( ) method to add items previously saved to a text file using streamChildren( ).
The TreeView object acts as the root of the tree. It contains the first level of TreeItem objects, which can contain their own TreeItem objects, thus forming a tree.
Unlike the deeper levels of the tree, you cannot collapse the first level of a tree. Therefore, you may want to use only one item at the first level of the tree to make the entire tree collapsible.