Moving annotations which are superimposed

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

Moving annotations which are superimposed

Post by bertrod » Fri Jun 16, 2006 7:59 am

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 ?

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

Post by Narcís » Fri Jun 16, 2006 11:00 am

Hi bertrod,

Thanks for reporting, I could reproduce this and added the issue to our wish-list to be enhanced for future releases.
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 » Tue Jul 11, 2006 7:14 am

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

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

Post by Pep » Mon Jul 17, 2006 8:20 am

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;

Post Reply