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?
Annotation mouse click fires chart mouse click FIRST
Re: Annotation mouse click fires chart mouse click FIRST
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:
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,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |