[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 3247

type TCustomTreeView = class(TCustomControl) end;

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(); virtual;

  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 CreateNodes; virtual;

  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 DefaultItemHeightIsStored;

  procedure DoAutoAdjustLayout(); override;

  function ExpandSignSizeIsStored;

  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 IndentIsStored;

  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 MoveSelection();

  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 DoCreateNodeClass(); virtual;

  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(); virtual;

  

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 MouseLeave; override;

  procedure NodeChanged(); virtual;

  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 ScrollView();

  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.

  property EditingItem: TTreeNode; [r]

  property States: TTreeViewStates; [r]

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]

  

Unfold a tree-item when user clicks it or an item activated by code.

  property BorderStyle: TBorderStyle;

  property HideSelection: Boolean; [rw]

  

If a control looses focus, then don't paint selection for a selected tree-item.

  property HotTrack: Boolean; [rw]

  

Additionally highlight/underline tree-item when mouse is over it.

  property Indent: Integer; [rws]

  

Size in pixels by which each nested branching level is to be indented.

  property MultiSelect: Boolean; [rw]

  

Allow to select several tree-items at a time, e.g. using Ctrl+click (select one item more) or Shift+click (select range of items).

  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 OnCustomDrawArrow: TTVCustomDrawArrowEvent; [rw]

  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 OnNodeChanged: TTVNodeChangedEvent; [rw]

  property OnSelectionChanged: TNotifyEvent; [rw]

  

OnSelectionChanged - event handler for a change in the selection

  property ReadOnly: Boolean; [rw]

  

Don't allow to change item captions by mouse click with a delay.

  property RightClickSelect: Boolean; [rw]

  

Right-click also selects tree-item. Else it only calls PopupMenu.

  property RowSelect: Boolean; [rw]

  

When a tree-item is selected, paint selection background with full width.

  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]

  

Show expand/collapse (fold/unfold) icons at left side for nodes with sub-nodes.

  property ShowLines: Boolean; [rw]

  

Show vertical lines at left side. They paint the tree structure for nested nodes.

  property ShowRoot: Boolean; [rw]

  

Show the root tree-item which is always present in code but may be hidden for user.

  property ShowSeparators: Boolean; [rw]

  property SortType: TSortType; [rw]

  

Allow to show items sorted: by caption, by Data property or both.

  property ToolTips: Boolean; [rw]

  

Show tooltip (hint) for a tree-item when the item is too long to fit by width and mouse is over it.

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 and 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;

  procedure Select();

  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();

  procedure MovePageDown();

  procedure MovePageUp();

  procedure MoveHome();

  procedure MoveEnd();

  property BackgroundColor: TColor; [rws]

  

Color of background area of control.

  property BorderWidth: TBorderWidth;

  

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

  property BottomItem: TTreeNode; [rw]

  

BottomItem - the last item on the list

  property Color: TColor;

  property DefaultItemHeight: Integer; [rws]

  

Default height of tree-items. If tvoAutoItemHeight is set in Options, this value is detected from font and icons.

  property DropTarget: TTreeNode; [rw]

  

DropTarget - the target node for dropping a dragged item

  property ExpandSignColor: TColor; [rw]

  

Color used to paint expand/collapse (fold/unfold) symbol (i.e. plus/minus symbol).

  property ExpandSignSize: Integer; [rws]

  

Size of expand/collapse (fold/unfold) symbol.

  property ExpandSignType: TTreeViewExpandSignType; [rw]

  

Sets shape of expand/collapse (fold/unfold) symbol: plus/minus, empty arrows, filled arrows etc.

  property Images: TCustomImageList; [rw]

  

TImageList object which holds icons for tree-items.

  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]

  

Collection of tree-items which is the content of control. Has type TTreeNodes.

  property KeepCollapsedNodes: Boolean; [rw]

  

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

  property MultiSelectStyle: TMultiSelectStyle; [rw]

  

Additional options for MultiSelect property.

  property Options: TTreeViewOptions; [rw]

  

Set of additional option flags for treeview.

  property ScrollBars: TScrollStyle; [rw]

  

Kind of scrollbars: horizontal, vertical, or both. Auto* mean that scrollbars hide automatically.

  property Selected: TTreeNode; [rw]

  

The Selected tree nodes

  property SelectionColor: TColor; [rw]

  

Color used to paint background of item selection.

  property SelectionCount: Cardinal; [r]

  property SelectionFontColor: TColor; [rw]

  

Color used to paint text of selected item.

  property SelectionFontColorUsed: Boolean; [rw]

  

Allow to use property SelectionFontColor. If not used, that color is detected automatically.

  property Selections []: TTreeNode; [r]

  property SeparatorColor: TColor; [rw]

  

Color used to paint horizontal lines between items, separators.

  property StateImages: TCustomImageList; [rw]

  

TImageList object which holds icons for tree-item states: normal item, selected item, etc.

  property TopItem: TTreeNode; [rw]

  

TopItem - the first visible node of the tree

  property TreeLineColor: TColor; [rw]

  

Color used to paint vertical lines at left side.

  property TreeLinePenStyle: TPenStyle; [rw]

  

Style of TPen, used to paint vertical lines at left side.

published

  property TabStop: Boolean;

  

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

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.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.