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

# TCustomShellTreeView.OnAddItem

Event handler signalled when an item (tree node) is added to the shell control.

## Declaration

Source position: shellctrls.pas line 143

`public property TCustomShellTreeView.OnAddItem : TAddItemEvent read FOnAddItem write FOnAddItem;`

## Description

OnAddItem is a TAddItemEvent property which contains the event handler signalled when an item (tree node) is added to the shell control. OnAddItem is signalled from the PopulateTreeNodeWithFiles method, and allows the base path and file information for each file to be checked before it is added to the Items for the tree view control.

An application must implement and assign an object procedure using the signature in TAddItemEvent to the handler. The Sender argument is the tree view control for the event notification. ABasePath contains the value from BasePath in the tree view control. AFileInfo is a TSearchRec instance with the attributes for the file system object represented in the node. CanAdd is a variable parameter which indicates whether the file system object should be added to the Items property. Set CanAdd to False in the event handler to omit the file system object in Items.

## See also

TCustomShellTreeView.Items |  | Contains the tree nodes used to represent the hierarchical tree structure for the tree view control.
TCustomShellTreeView.PopulateTreeNodeWithFiles |  | Adds tree nodes for file system objects found starting at the specified node / path.
TAddItemEvent |  | Specifies an event handler signalled when an item is added to a shell control.