Page 1 of 1

Moving annotations which are superimposed

Posted: Fri Jun 16, 2006 7:59 am
by 9343260
Hello,

When you click at a place where 2 annotations are superimposed, the one which is behind is selected, and not the foreground annotation as it should be.

See the example below : I clicked on top of the first annotation and it's the one which is behind that has been selected.

Image

Is there a way to correct this problem ?

Posted: Fri Jun 16, 2006 11:00 am
by narcis
Hi bertrod,

Thanks for reporting, I could reproduce this and added the issue to our wish-list to be enhanced for future releases.

Posted: Tue Jul 11, 2006 7:14 am
by 9343260
narcis wrote:Hi bertrod,

Thanks for reporting, I could reproduce this and added the issue to our wish-list to be enhanced for future releases.
Hey Narcis,

I don't have time to wait for the next release and I will try to solve this problem myself. Could you help me a little bit by telling me how do you think it's possible to know which annotation is OVER the other one ? Can I use the order of creation or something like this ?

Thanks

Posted: Mon Jul 17, 2006 8:20 am
by Pep
Hi bertrod,

to accomplish it you could use similar code to the following :

Code: Select all

procedure TDragAnnotation.Chart1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var i,xx,yy : integer;
s: string;
begin
     with Chart1.Tools do
     begin
       for i := 0 to Count -1 do
       begin
         with Items[i] as TAnnotationTool do
         begin
           if Clicked(X,Y) then
           begin
             Fitem := i;
           end;
         end;
       end;
       // save text of the annotation
       s:= (chart1.Tools.Items[fitem] as TAnnotationTool).Text;
       xx:= (chart1.Tools.Items[fitem] as TAnnotationTool).Shape.Left;
       yy:= (chart1.Tools.Items[fitem] as TAnnotationTool).Shape.Top;
       chart1.Tools.Delete(fitem);
       with (Chart1.Tools.Add(TAnnotationTool.Create(Chart1)) as TAnnotationTool)
       do begin
        ParentChart := Chart1;
        Text := s;
        Shape.CustomPosition := True;
        Shape.Left := xx;
        Shape.Top := yy;
      end;
     end;
end;