vcl-dxtreeview-ab05bb2f.md
The image index retrieval procedural type for tree nodes.
TdxTreeViewGetImageIndexEvent = procedure(Sender: TdxCustomTreeView; ANode: TdxTreeViewNode; var AImageIndex: Integer) of object;
| Name | Type | Description |
|---|---|---|
| Sender | TdxCustomTreeView |
The Tree View control that raised an image index retrieval event.
| | ANode | TdxTreeViewNode |
The target tree node.
| | AImageIndex | Integer |
An index of the image displayed in the target tree node.
|
The following OnGetImageIndex event handler assigns images with the indexes 1 and 2 to expanded and collapsed nodes, respectively.
procedure TForm1.dxTreeViewControl1GetImageIndex(Sender: TdxCustomTreeView;
ANode: TdxTreeViewNode; var AImageIndex: Integer);
begin
if ANode.HasChildren then
if ANode.Expanded then
ANode.ImageIndex := 1
else
ANode.ImageIndex := 2;
end;
void __fastcall TForm1::dxTreeViewControl1GetImageIndex(TdxCustomTreeView *Sender,
TdxTreeViewNode *ANode, int &AImageIndex)
{
if (ANode->HasChildren)
if (ANode->Expanded)
ANode.ImageIndex = 1;
else
ANode.ImageIndex = 2;
}
Note
A tree node’s ExpandedImageIndex allows you to do the same without an OnGetImageIndex event handler.
The Tree View’s OnGetImageIndex and OnGetSelectedImageIndex events reference the TdxTreeViewGetImageIndexEvent type.
See Also