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

# TCustomShellTreeView.PopulateTreeNodeWithFiles

Adds tree nodes for file system objects found starting at the specified node / path.

## Declaration

Source position: shellctrls.pas line 108

`protected function TCustomShellTreeView.PopulateTreeNodeWithFiles(`
`ANode: TTreeNode;`
`ANodePath: string`
`):Boolean;`

## Arguments

`ANode` |  | Initial tree node used when filling the Items for the shell control.
`ANodePath` |  | Path to the initial tree node used in the method.

## Function result

Returns True if at least one item was added to the shell control.

## Description

PopulateTreeNodeWithFiles is a Boolean function used to fill the Items property with the file system objects for a given tree node. ANode contains the initial tree node examined in the method. ANodePath contains the path on the local file system to the tree node in ANode. The return value is True if at least one node was added to Items in the method.

No actions are performed in the method at design-time, and the return value is set to False.

PopulateTreeNodeWithFiles fills a list with TFileItem instances for file system objects matching the ObjectTypes for the shell control. DoAddItem is called for each TFileItem instance, which signals the OnAddItem event handler (when assigned). The event handler is used to selectively filter file system objects added to the Items in the control. If the TAddItemEvent handler sets its CanAdd argument to False, the file system object is not added to Items.

On exit, Items contains the TShellTreeNode instances where ANode is the parent. If an entry is a directory which has sub-directories, its HasChildren property is set to True.

PopulateTreeNodeWithFiles is used in the implementation of the PopulateWithBaseFiles and CanExpand methods in TCustomShellTreeView.

## See also

TCustomShellTreeView.ObjectTypes |  | Indicates the file system objects displayed using the control.
TCustomShellTreeView.Items |  | Contains the tree nodes used to represent the hierarchical tree structure for the tree view control.
TCustomShellTreeView.DoAddItem |  | Performs actions needed to add a new tree node to the shell control.
TCustomShellTreeView.CanExpand |  | Determines if the specified tree node can be expanded in the shell tree view control.
TCustomShellTreeView.PopulateWithBaseFiles |  | Fills the tree view when the Root directory is empty.
TShellTreeNode |  | Represents tree nodes in TCustomShellTreeView / TShellTreeView.