Page 1 of 1

Disable annotation moving ?

Posted: Wed May 17, 2006 9:43 am
by 9343260
Hello,

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

Posted: Wed May 17, 2006 12:05 pm
by narcis
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;

Posted: Wed May 17, 2006 12:34 pm
by 9343260
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 ? :?

Posted: Sun May 21, 2006 10:52 pm
by Pep
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.