Using TAnnotationTool at runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
mconstant68
Newbie
Newbie
Posts: 2
Joined: Tue Apr 20, 2021 12:00 am

Using TAnnotationTool at runtime

Post by mconstant68 » Mon Jun 21, 2021 9:13 pm

I am trying to create/delete TAnnotationTool at runtime so I can show text messages base on user choice.

I am able to create them at run time, but I am running in to few issues.

1- I can create them and add them to the tools list of the TChart object, but I am unable to delete them. I always get an invalid pointer error.

Is possible to create/delete the annotation at runtime?

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Using TAnnotationTool at runtime

Post by Yeray » Thu Jun 24, 2021 10:58 am

Hello,

This seems to work fine for me without problems:

Code: Select all

uses TeeTools;

procedure TForm1.Button1Click(Sender: TObject);
begin
  TAnnotationTool(Chart1.Tools.Add(TAnnotationTool)).Text:='Annotation';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if (Chart1.Tools.Count>0) and (Chart1.Tools[0] is TAnnotationTool) then
  begin
    Chart1.Tools.Delete(0);
    Chart1.Draw;
  end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply