TVGetImageIndex (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example shows how the OnGetImageIndex event handler can be used to indicate a different state for the node.

Code

procedure TCustomDrawForm.TVGetImageIndex(Sender: TObject; Node: TTreeNode);
begin
  if Node.HasChildren then
    if Node.Expanded then
      Node.ImageIndex := 3
    else
      Node.ImageIndex := 0
  else
    Node.ImageIndex := 1;
end;

procedure TCustomDrawForm.TVGetSelectedIndex(Sender: TObject; Node: TTreeNode);
begin
  Node.SelectedIndex := Node.ImageIndex;
end;

Uses