Page 1 of 1

List Index out of bounds...TChartTools

Posted: Tue Aug 19, 2025 11:52 pm
by 9236183
I seem to be getting the following error popup from time to time, I've not narrowed it down to when as there are lots of factors.

List index out of bounds (18). TChartTools range is 0..17

I've not been able to trigger this error reliably yet.

I suspect it could be due to a group of TPointSeries graphs that have an associated TMarksTipTool assigned to them for hint popup.

It could be a thread creation timing issue. Is there a way to stop this error popping up ?

Re: List Index out of bounds...TChartTools

Posted: Tue Aug 19, 2025 11:54 pm
by 9236183
Forgot to say this is with TChart v2025.43 and BDS 12.3 Update 3

Re: List Index out of bounds...TChartTools

Posted: Wed Aug 20, 2025 7:17 am
by yeray
Hello,

Difficult to say without the code.
I guess you may be accessing the list of tools with an out of range index. To prevent that, you can add an if condition before accessing it. Ie:

Code: Select all

var toolIndex: Integer;
begin
  toolIndex:=myIndex;

  if toolIndex >= Chart1.Tools.Count then Exit;

  // Now it should be safe to get the tool at the toolIndex
  Chart1.Tools[toolIndex]...
end;