Back to Devexpress

TdxTreeViewGetImageIndexEvent Type

vcl-dxtreeview-ab05bb2f.md

latest2.0 KB
Original Source

TdxTreeViewGetImageIndexEvent Type

The image index retrieval procedural type for tree nodes.

Declaration

delphi
TdxTreeViewGetImageIndexEvent = procedure(Sender: TdxCustomTreeView; ANode: TdxTreeViewNode; var AImageIndex: Integer) of object;

Parameters

NameTypeDescription
SenderTdxCustomTreeView

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.

|

Remarks

The following OnGetImageIndex event handler assigns images with the indexes 1 and 2 to expanded and collapsed nodes, respectively.

delphi
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;
cpp
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

dxTreeView Unit