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

# TAddItemEvent

Specifies an event handler signalled when an item is added to a shell control.

## Declaration

Source position: shellctrls.pas line 77

`type TAddItemEvent = procedure(`
`Sender: TObject;`
`const ABasePath: string;`
`const AFileInfo: TSearchRec;`
`var CanAdd: Boolean`
`) of object;`

## Arguments

`Sender` |  | Object (control) generating the event notification.
`ABasePath` |  | Base path for the item added to the shell control.
`AFileInfo` |  | Search record with information for the item added to the shell control.
`CanAdd` |  | True if the item can be added.

## Description

TAddItemEvent specifies an event handler signalled when an item is added to a shell control. TAddItemEvent is the type used to implement the OnAddItem event handler in TCustomShellListView and TCustomShellTreeView.

Applications must implement and assign an object procedure using the signature for the event to respond to the notification. The Sender argument must be cast to the correct class type to access properties and method in the control. Set the value in the CanAdd variable parameter to False to prevent the item from being added in the calling procedure.

## See also

TCustomShellTreeView.PopulateTreeNodeWithFiles |  | Adds tree nodes for file system objects found starting at the specified node / path.
TCustomShellTreeView.OnAddItem |  | Event handler signalled when an item (tree node) is added to the shell control.