Disable annotation moving ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Disable annotation moving ?

Post by bertrod » Wed May 17, 2006 9:43 am

Hello,

Is it possible to block a TAnnotationTool so that the user cannot move it anymore ? I couldn't find anything about this.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 17, 2006 12:05 pm

Hello bertrod,

By default, an annotation tool can not be moved by user if you don't grant them access to the chart editor tools tab doing this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
Var NewTabs : TChartEditorHiddenTabs;
begin
  NewTabs:=[cetTools];
  ChartEditor1.HideTabs:=ChartEditor1.HideTabs+NewTabs
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ChartEditor1.Execute;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Post by bertrod » Wed May 17, 2006 12:34 pm

I would like to disable only some TAnnotations, not all. And I'm not using the chart editor tool. I don't feel like adding it only to block 2 or 3 annotations.

I tried to edit a bit the code in the TeeTools.pas file, but I couldn't find exactly what function is called when the user is moving the annotation. Do you have another suggestion ? :?

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Sun May 21, 2006 10:52 pm

Hi,

I think you're referencing to the TRectangle tool. which can be dragged using the mouse. If so, one way to lock some of the TRectangle tool could be to use similar code to the following (in the OnDragging event, locking the second TRectangle tool) :

Code: Select all

procedure TForm1.ChartTool2Dragging(Sender: TObject);
begin
ChartTool2.Left:=30;
ChartTool2.Top:=30;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ChartTool2.Left:=30;
ChartTool2.Top:=30;
Chart1.Draw;
end;
Another way around this could be to use TAnnotation tools (setting the same brushes, pens, etc.. to get the same aspect) for the annotation which must be locked and TRectangle tools for the other.

Post Reply