Page 1 of 1

prevent OnMouseMove event triggering

Posted: Mon Aug 17, 2009 12:09 pm
by 9243846
Hi,
I would like to prevent the OnMouseMove event triggering when the cursor is NOT over the actual chart drawing area.

Is this possible?

By the way what is the correct terminology for "the actual chart drawing area" :oops:

Tony

Re: prevent OnMouseMove event triggering

Posted: Tue Aug 18, 2009 9:49 am
by yeray
Hi Tony,

I'm afraid you should test if the mouse cursor is in the target area manually:

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var dummyPoint: TPoint;
begin
  dummyPoint.X := X;
  dummyPoint.Y := Y;

  if PtInRect(Chart1.ChartRect, dummyPoint) then
  begin
    //your code
  end;
end;
So if you mean the rectangle formed by the left and the bottom axes, we call it "ChartRect". 8)

Re: prevent OnMouseMove event triggering

Posted: Mon Aug 24, 2009 10:27 am
by 9243846
Thank you very much, that's exactly what I needed.

Please let me know if you ever get to visit the U.K.,
I would be delighted to introduce you to a quaint old English custom called "Pub Crawling".


Tony

Re: prevent OnMouseMove event triggering

Posted: Mon Aug 24, 2009 11:26 am
by yeray
Hi Tony,

It's a pleasure trying to be helpful!

Thanks for the invitation! It looks culturally really interesting! ;)