Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Example: OnGetNodeImageIndex

The following example shows how to handle the OnGetNodeImageIndex event. The event handler specifies the custom node image depending on the node level and the node’s hot-track state.

procedure <Form>.<TreeList>GetNodeImageIndex(Sender: TcxCustomTreeList; ANode: TcxTreeListNode; AIndexType: TcxTreeListImageIndexType; var AIndex: TImageIndex);
begin
// exit from the handler if the currently handled image is a state image or a overlay state image
  if AIndexType in [tlitStateIndex, tlitOverlayStateIndex] then Exit;
  if ANode.Level = 0 then
  begin
    AIndex := 0;
    if ANode.Expanded then
      Inc(AIndex);
  end
  else
    AIndex := 4;
    if ANode.HotTrack then
      if ANode.Level = 0 then
        Inc(AIndex, 2)
      else
        Inc(AIndex);
end;