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

# TTreeNodes.Assign

Implements object persistence for the tree node container.

## Declaration

Source position: comctrls.pp line 3283

`public procedure TTreeNodes.Assign(`
`Source: TPersistent`
`); override;`

## Arguments

`Source` |  | Persistent object with the values copied in the method.

## Description

Assign is an overridden method in TTreeNodes used to copy values from the persistent object in Source to the current class instance. Assign ensures that the cache for the container is cleared prior to loading values from Source.

If Source is derived from TTreeNodes, the nodes in the container are cleared and recreated from the nodes in Source. Node information handled in the method includes:

- ImageIndex
- SelectedIndex
- OverlayIndex
- StateIndex
- Height
- Data pointer (depending on LCL version)
- Count
- Expanded
- Text

If Source is not derived from TTreeNodes, the inherited method is called to perform object persistence.

If Source is Nil, an EConvertError exception is raised.

## See also

TTreeNodes.Clear |  | Removes tree nodes in the container and its internal cache.
TTreeNode |  | Implements a tree node displayed in a TTreeView control.
TPersistent.Assign