In a TLineSeries
called serie1
with parent chart cht1
, where I have visible marks, I'm trying to move one mark by code. My problem is that when I try to set mark position's Custom property to true, I get an "access violation" exception. But, if I drag the mark (with a TDragMarksTool attached to the chart and active) it moves. After that, "custom" position is true and I can move the mark by code.
This in one button's click event.
serie1.Marks[10].Visible:=True;
serie1.Marks.Positions.Position[10].Custom:=true; <<< Exception here.
I'm using Delphi XE4 and Teechart 2014, don't have my laptop here to see the exact version numbers.
Some properties aren't initialized until the chart has been entirely drawn.
Try forcing a chart repaint calling cht1.Draw;
before accessing serie1.Marks.Positions.Position
array.