Annotation mouse click fires chart mouse click FIRST

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Phineas
Newbie
Newbie
Posts: 18
Joined: Wed Apr 09, 2008 12:00 am

Annotation mouse click fires chart mouse click FIRST

Post by Phineas » Mon Sep 21, 2009 1:50 am

I have a problem with TAnnotations. I create them on the fly and place them on a chart and give them a click property.

With MyAnnotation do
OnClick := AnnotationClick;

procedure Chart1.AnnotationClick(Sender: TAnnotationTool; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
If (Button = mbRight) then ...

All went well when mouse clicking on the annotation. I captured the right mouse button and did further processing.

However, I have now given the chart a mousedown event capturing the right mouse button for further processing.

Now when clicking on the annotation, the charts mouse click fires first. Not the annotations mouse click. The annotation click fires second. Have you any idea how I may get around this? How can I recognise the annotation has been clicked and so get the charts mouse click to disregard further processing?

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

Re: Annotation mouse click fires chart mouse click FIRST

Post by Yeray » Mon Sep 21, 2009 11:38 am

Hi Phineas,

You can use the Annotation.Clicked function to see if the OnMouseDown event has been fired over the annotation or not. For example:

Code: Select all

procedure TForm1.MouseDown(Sender:TObject; Button:TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Annotation.Clicked(X,Y) then
    ShowMessage('annotation clicked!')
  else
    ShowMessage('mouse down!');
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