[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'ComCtrls' (#lcl)

TCustomTreeView

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TCustomTreeView - ancestor class for TTreeView

Declaration

Source position: comctrls.pp line 3018

type TCustomTreeView = class(TCustomControl)

protected

  FChangeTimer: TTimer;

  

FChangeTimer - local variable to act as timer for changes

  FEditor: TEdit;

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  class function GetControlClassDefaultSize; override;

  procedure Added(); virtual;

  procedure EditorEditingDone(); virtual;

  procedure EditorKeyDown(); virtual;

  procedure BeginAutoDrag; override;

  

For internal use: user has started dragging the control.

  procedure BeginEditing();

  function DoDragMsg(); override;

  

Dispatches a drag message, sent by the DragManager.

  function CanChange(); virtual;

  

CanChange - returns True if a given TreeNode can be changed

  function CanCollapse(); virtual;

  

CanCollapse returns True if a given TreeNode is able to be collapsed

  function CanEdit(); virtual;

  

CanEdit - returns True if a Given TreeNode is allowed to be edited

  function CanExpand(); virtual;

  

CanExpand - returns True if the specified TreeNode can be expanded

  function CreateNode; virtual;

  

CreateNode - creates a new node in a TreeView and returns its content

  function CustomDraw(); virtual;

  

CustomDraw - returns True if Custom Drawing is proceeding in the specified Rectangle

  function CustomDrawItem(); virtual;

  

CustomDrawItem - returns True if Custom Image drawing is proceeding at the specified TreeNode

  function GetDragImages; override;

  

Get the list of images usable during dragging.

  function GetMaxLvl;

  

GetMaxLvl - returns the maximum level of branching of the tree structure

  function GetMaxScrollLeft;

  

GetMaxScrollLeft - returns maximal extent of scrolling to the left

  function GetMaxScrollTop;

  

GetMaxScrollTop - returns the maximal extent of scrolling upwards

  function GetNodeAtY();

  

GetNodeAtY - returns the node at the specified (absolute) Y coordinate

  function GetNodeDrawAreaHeight;

  

GetNodeDrawAreaHeight - returns the height for the area in which node is drawn

  function GetNodeDrawAreaWidth;

  

GetNodeDrawAreaWidth - returns the width for the area in which node is drawn

  function IsCustomDrawn(); virtual;

  

IsCustomDrawn - returns True if the specified target node is custom drawn

  function IsNodeVisible();

  

IsNodeVisible - returns True if the specified node is visible

  function IsNodeHeightFullVisible();

  

IsNodeHeightFullVisible - returns True if the full height of the specified node is visible in the current view

  function IsInsertMarkVisible; virtual;

  

IsInsertMarkVisible - returns True if an Insert mark is visible

  procedure Change(); virtual;

  

Change - software emulation of the OnChange event

  procedure Collapse(); virtual;

  

Collapse - software emulation of the OnCollapsed event

  procedure CreateWnd; override;

  

Creates the interface object (widget) and assigns it to Handle.

  procedure Delete(); virtual;

  

Delete - remove the specified node from the tree structure (software emulation of the OnDeletion event)

  procedure DestroyWnd; override;

  

Destroys the interface object (widget).

  procedure DoEndDrag(); override;

  

Invokes the OnEndDrag handler.

  function DoMouseWheel(); override;

  

Invokes the OnMouseWheel handlers, when the wheel has been turned.

  procedure DoPaint; virtual;

  

DoPaint - perform the actual painting

  procedure DoPaintNode(); virtual;

  

DoPaintNode - perform the actual painting of the specified node

  procedure DoStartDrag(); override;

  

Invokes the OnStartDrag handler

  procedure DragOver(); override;

  

Called when an object is dragged over this control. Determines whether a drop is acceptable, using the OnDragOver handler.

  procedure EndEditing();

  

EndEditing - finish editing

  procedure EnsureNodeIsVisible();

  

EnsureNodeIsVisible - method to make sure specified node is visible

  procedure Expand(); virtual;

  

Expand the specified node

  procedure GetImageIndex(); virtual;

  

GetImageIndex - returns the index of the image associated with the specified node

  procedure GetSelectedIndex(); virtual;

  

GetSelectedIndex - returns the index of the selected node

  procedure InitializeWnd; override;

  

Copies cached control properties to the just created widget.

  procedure KeyDown(); override;

  

Invokes the OnKeyDown handler.

  procedure Loaded; override;

  

Called when the control has been loaded from a resource, transfers the loaded property values to the widget.

  procedure MouseDown(); override;

  

Handler for MouseDown events.

  procedure MouseMove(); override;

  

Handler for MouseMove events.

  procedure MouseUp(); override;

  

Invokes the OnMouseUp handler.

  procedure Notification(); override;

  

Notification handler for insertion or deletion of components.

  procedure Paint; override;

  

Override this method in your derived class with your own paint handler.

  procedure SetDragMode(); override;

  procedure SetOptions(); virtual;

  

SetOptions - specifies the options for the TreeView

  procedure UpdateDefaultItemHeight; virtual;

  

UpdateDefaultItemHeight - brings the value of the default item height up-to-date

  procedure UpdateInsertMark(); virtual;

  

UpdateInsertMark - see if there is an insert mark at X,Y and put one in if necessary

  procedure DoSelectionChanged; virtual;

  

DoSelectionChanged - perform the code required for a change in selection

  procedure WMHScroll(); message;

  

WMHScroll - LCL Message for horizontal scroll

  procedure WMVScroll(); message;

  

WMVScroll - LCL Message for Vertical scroll

  procedure WMLButtonDown(); message;

  

Message handler for left mouse button going down.

  procedure WMSetFocus(); message;

  procedure WMKillFocus(); message;

  procedure Resize; override;

  

Checks for changes and calls DoOnResize if needed.

public

  function GetSelectedChildAccessibleObject; override;

  function GetChildAccessibleObjectAtPos(); override;

  property AccessibilityOn: Boolean; [rw]

  

Allows to turn accessibility off to speed up the control

protected

  property AutoExpand: Boolean; [rw]

  

AutoExpand - if True, the tree structure is automatically expanded when a node is selected

  property BorderStyle;

  property HideSelection: Boolean; [rw]

  

HideSelection - if True, the selected part of the tree is to be hidden

  property HotTrack: Boolean; [rw]

  

HotTrack - the property whereby the item under the mouse pointer becomes emphasised

  property Images: TCustomImageList; [rw]

  

Images - the ImageList to be used in association with the list of TreeNodes

  property Indent: Integer; [rw]

  

Indent - the amount by which each successive level of branching is to be indented in the tree structure

  property MultiSelect: Boolean; [rw]

  property OnAddition: TTVExpandedEvent; [rw]

  property OnAdvancedCustomDraw: TTVAdvancedCustomDrawEvent; [rw]

  

OnAdvancedCustomDraw - event handler for advanced custom drawing

  property OnAdvancedCustomDrawItem: TTVAdvancedCustomDrawItemEvent; [rw]

  

OnAdvancedCustomDrawItem - event handleer for advanced custom drawing item

  property OnChange: TTVChangedEvent; [rw]

  

OnChange - specialised event handler for a change in the TreeView

  property OnChanging: TTVChangingEvent; [rw]

  

OnChanging - specialised event handler while TreeView is being changed

  property OnCollapsed: TTVExpandedEvent; [rw]

  

OnCollapsed - specialised event handler when part of the tree is collapsed

  property OnCollapsing: TTVCollapsingEvent; [rw]

  

OnCollapsing - specialised event handler while part of the tree is being collapsed

  property OnCompare: TTVCompareEvent; [rw]

  

OnCompare - specialised event handler for comparisons within the TreeView

  property OnCreateNodeClass: TTVCreateNodeClassEvent; [rw]

  property OnCustomCreateItem: TTVCustomCreateNodeEvent; [rw]

  

OnCustomCreateItem - event handler for custom item creation

  property OnCustomDraw: TTVCustomDrawEvent; [rw]

  

OnCustomDraw - event handler for custom drawing

  property OnCustomDrawItem: TTVCustomDrawItemEvent; [rw]

  

OnCustomDrawItem - event handler for custom drawing item

  property OnDeletion: TTVExpandedEvent; [rw]

  

OnDeletion - specialised event handler for deletion of node(s) from the tree

  property OnEdited: TTVEditedEvent; [rw]

  

OnEdited - specialised event handler when the TreeView has been edited

  property OnEditing: TTVEditingEvent; [rw]

  

OnEditing - specialised event handler while a TreeView is being edited

  property OnEditingEnd: TTVEditingEndEvent; [rw]

  property OnExpanded: TTVExpandedEvent; [rw]

  

OnExpanded - specialised event handler when a TreeView has been expanded

  property OnExpanding: TTVExpandingEvent; [rw]

  

OnExpanding - specialised event handler while a TreeView is being expanded

  property OnGetImageIndex: TTVExpandedEvent; [rw]

  

OnGetImageIndex - event handler for finding the index of an image

  property OnGetSelectedIndex: TTVExpandedEvent; [rw]

  

OnGetSelectedIndex - event handler for finding index of selected item

  property OnSelectionChanged: TNotifyEvent; [rw]

  

OnSelectionChanged - event handler for a change in the selection

  property ReadOnly: Boolean; [rw]

  

ReadOnly - if True, the TreeView can only be observed, and not Written to or changed. Default False

  property RightClickSelect: Boolean; [rw]

  

RightClickSelect - if True, a Right Click selects an Item. Default False

  property RowSelect: Boolean; [rw]

  

RowSelect - if True, a row is selected

  property ScrolledLeft: Integer; [rw]

  

ScrolledLeft - the position of the tree when fully scrolled to the left

  property ScrolledTop: Integer; [rw]

  

ScrolledTop - the position of the tree when fully scrolled to the top

  property ShowButtons: Boolean; [rw]

  

ShowButtons - if True, buttons are displayed

  property ShowLines: Boolean; [rw]

  

ShowLines - show the connecting lines of the tree structure

  property ShowRoot: Boolean; [rw]

  

ShowRoot - if True, the root of the tree structure is displayed

  property ShowSeparators: Boolean; [rw]

  

ShowSeparators - if True, separators are shown between items

  property SortType: TSortType; [rw]

  

SortType - the way the items are to be sorted: None, by Data, by Text or Both

  property StateImages: TCustomImageList; [rw]

  

StateImages - the list of images to denote state of the tree (expanded, contracted etc)

  property ToolTips: Boolean; [rw]

  

ToolTips - if True (default), pop-up tool tips are to be shown

public

  constructor Create(); override;

  

Create - constructor for TCustomTreeView: calls inherited Create then sets defaults for style, size, etc

  destructor Destroy; override;

  

Destroy - destructor for TCustomTreeView: frees images, nodes and links, then calls inherited Destroy

  function AlphaSort;

  

If True, sort alphabetically

  procedure ClearSelection(); virtual;

  procedure ConsistencyCheck;

  

ConsistencyCheck - check that indexes of treenodes match those of images etc

  function CustomSort();

  

CustomSort - if True, an external sorting method specified by SortProc is to be used

  function DefaultTreeViewSort();

  

DefaultTreeViewSort - returns result of string comparison between names of Node1 and Node2

  procedure EraseBackground(); override;

  

Fills the entire control with the designed background color and pattern.

  function GetHitTestInfoAt();

  

GetHitTestInfoAt - returns the result of a hit test at the point (X, Y)

  function GetNodeAt();

  

GetNodeAt - returns the TreeNode at position (X. Y)

  procedure GetInsertMarkAt();

  

GetInsertMarkAt - find if there is an insert mark at the specified coordinates

  procedure SetInsertMark();

  

SetInsertMark - place an Insert mark at the specified node in the tree

  procedure SetInsertMarkAt(); virtual;

  

SetInsertMarkAt - place an insert mark at the specified coordinates

  procedure Invalidate; override;

  

Force a delayed Repaint of the control, by marking its visible area of the control as invalid.

  function IsEditing;

  

IsEditing - returns True if editing is in progress

  procedure BeginUpdate;

  

BeginUpdate - start the update of the display

  procedure EndUpdate;

  

EndUpdate finishes updating the display

  procedure FullCollapse;

  

FullCollapse - method to collapse the treeview fully, ie show just the root

  procedure FullExpand;

  

FullExpand - method to expand the treeview fully, and show all the branches

  procedure LoadFromFile();

  

LoadFromFile - load the data from the specified file

  procedure LoadFromStream();

  

LoadFromStream - load data from the specified stream

  procedure SaveToFile();

  

SaveToFile - saves the data to the specified file

  procedure SaveToStream();

  

SaveToStream - save the data to the specified stream

  procedure WriteDebugReport();

  

WriteDebugReport - used for debugging

  procedure LockSelectionChangeEvent;

  

LockSelectionChangeEvent - if the selection has changed, lock its status

  procedure UnlockSelectionChangeEvent;

  

UnlockSelectionChangeEvent - unlock a selection to allow it to be changed

  function GetFirstMultiSelected;

  

GetFirstMultiSelected - returns the first node from a multiple selection

  function GetLastMultiSelected;

  function SelectionVisible;

  

SelectionVisible - returns True if a selection is visible

  procedure MakeSelectionVisible;

  

MakeSelectionVisible - method for making a selection visible

  procedure ClearInvisibleSelection;

  function StoreCurrentSelection;

  procedure ApplyStoredSelection();

  procedure MoveToNextNode;

  procedure MoveToPrevNode;

  property BackgroundColor: TColor; [rw]

  

BackgroundColor for the treeview

  property BorderWidth;

  

Width of the Border around the control; default is zero.

  property BottomItem: TTreeNode; [rw]

  

BottomItem - the last item on the list

  property DefaultItemHeight: Integer; [rw]

  

DefaultItemHeight - default height for items on the list

  property DropTarget: TTreeNode; [rw]

  

DropTarget - the target node for dropping a dragged item

  property ExpandSignType: TTreeViewExpandSignType; [rw]

  

ExpandSignType - the symbols to denote whether a list is expanded or collapsed; default is plus or minus

  property InsertMarkNode: TTreeNode; [rw]

  

InsertMarkNode - place a marker on the specified node

  property InsertMarkType: TTreeViewInsertMarkType; [rw]

  

InsertMarkType - the type of marker to be inserted

  property Items: TTreeNodes; [rw]

  

Items - the collection of TreeNodes that comprise the TreeView

  property KeepCollapsedNodes: Boolean; [rw]

  

KeepCollapsedNodes - if True, the collapsed nodes are to be retained

  property MultiSelectStyle: TMultiSelectStyle; [rw]

  property Options: TTreeViewOptions; [rw]

  

The set of Options for displaying the tree view

  property ScrollBars: TScrollStyle; [rw]

  

ScrollBars - the style of scroll bars for the treeview display

  property Selected: TTreeNode; [rw]

  

The Selected tree nodes

  property SelectionColor: TColor; [rw]

  

SelectionColor - the colour to be used for the selected nodes, to distinguish them from the others

  property SelectionCount: Cardinal; [r]

  property Selections: TTreeNode; [r]

  property SeparatorColor: TColor; [rw]

  

SeparatorColor - the colour to be used for separators

  property TopItem: TTreeNode; [rw]

  

TopItem - the first visible node of the tree

  property TreeLineColor: TColor; [rw]

  

TreeLineColor - the colour to be used for the lines showing the tree structure

  property TreeLinePenStyle: TPenStyle; [rw]

  

TreeLinePenStyle - the pen style for drawing lines on the tree

  property ExpandSignColor: TColor; [rw]

  

ExpandSignColor - the colour to be used for the expand/collapse symbols

published

  property TabStop;

  

Allows the user to navigate to this control, by pressing the Tab key.

end;

Inheritance

TCustomTreeView

  

TCustomTreeView - ancestor class for TTreeView

|

TCustomControl

  

The base class for windowed controls which paint themselves.

|

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

TCustomTreeView - ancestor class for TTreeView, which displays a collection of items in a hierarchical tree form. This class defines many properties which are inherited by children classes, including loading the data from files or streams, saving to files or streams, updating, sorting alphabetically, editing, making visible or invisible, expanding or collapsing the tree display, and many more.

Please note that Accessibility support in TCustomTreeView might make this control slower if there is a very large number of items, for example, 10.000+ items. If the performance impact is unacceptable it is possible to turn accessibility off for tree view items by setting TCustomTreeView.AccessibilityOn to false. The default value is true.