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

# TCustomTreeView.OnCreateNodeClass

Event handler signalled to get the class reference used to create new tree nodes.

## Declaration

Source position: comctrls.pp line 3674

`protected property TCustomTreeView.OnCreateNodeClass : TTVCreateNodeClassEvent read FOnCreateNodeClass write FOnCreateNodeClass;`

## Description

OnCreateNodeClass is signalled (when assigned) when the CreateNode method is executed for the tree view control.

OnCreateNodeClass occurs after the OnCustomCreateItem event handler has been signalled to get a TTreeNode for the purpose. If its return value is Nil, DoCreateNodeClass is called to signal OnCreateNodeClass. It is not signalled if a return value was assigned in the OnCustomCreateItem handler routine.

Sender contains the tree view control for the event handler.

NodeClass is used to return the class reference needed to create a new node for the control.

A new instance of the class type is created and added to the node collection in Items.

## See also

TCustomTreeView.CreateNode |  | CreateNode - creates a new node in a TreeView and returns its content.
TCustomTreeView.DoCreateNodeClass |  | Signals the OnCreateNodeClass event handler (when assigned).
TCustomTreeView.Items |  | The container with the TTreeNode instances for the control.
TCustomTreeView.OnCustomCreateItem |  | OnCustomCreateItem - event handler for custom item creation.
TTreeNodes.AddNode |  | Adds or inserts a tree node as a sibling to a specified relative node.
TTreeNodes.AddObject |  | Adds a node with the specified text and data at the same level as the sibling node.
TTreeNodes.AddChildObject |  | Adds a child node with specified text and data to the parent node and returns the new node.
TTreeNodes.AddObjectFirst |  | Adds a node with the specified text and data as the first node at the same level as the sibling node.
TTreeNodes.AddChildObjectFirst |  | Adds a node with the specified text and data as the first child node in the parent node.
TTreeNodes.InternalAddObject |  | Creates or updates a tree node with the specified text and a pointer to data.
TTreeNode |  | Implements a tree node displayed in a TTreeView control.