Page 1 of 1

OnClickPointer event problems

Posted: Tue Jun 08, 2010 6:34 am
by 16555997
Hi

(TeeChart Pro v2010 VCL, Delphi 2007)

I have some problems with mouse events in TPointSeries. I want the OnClickPointer event to fire when users click on points. If I assign an event handler to that event without assigning OnMouseEnter or OnMouseLeave the event fires as expected.

However, if I also assign OnMouseEnter and/or OnMouseLeave then OnClickPointer event also fires when entering, leaving, mouse down, mouse up, and even just moving the mouse above a point. This behaviour is not what I expected? I need all events. Is this a bug, or am I doing something wrong?

The problem seems to be in TeEngine.pas, Function TChartSeries.CheckMouse(x,y:Integer):Boolean;

Test code to reproduce (simply put a chart on a form):

**********

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, TeeProcs, TeEngine, Chart, Series;

type

TForm1 = class(TForm)
Chart1: TChart;
procedure FormCreate(Sender: TObject);
private
procedure OnClickPointer(Sender: TCustomSeries; ValueIndex: Integer; X, Y: Integer);
procedure OnMouseEnter(Sender: TObject);
procedure OnMouseLeave(Sender: TObject);
public
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
PointSeries : TPointSeries;
begin
PointSeries := TPointSeries.Create(Self);
PointSeries.ParentChart := Chart1;
PointSeries.Pointer.Size := 10;
PointSeries.OnClickPointer := OnClickPointer;
PointSeries.OnMouseEnter := OnMouseEnter;
PointSeries.OnMouseLeave := OnMouseLeave;
PointSeries.FillSampleValues(10);
end;

procedure TForm1.OnClickPointer(Sender: TCustomSeries; ValueIndex, X, Y: Integer);
begin
Caption := Caption + 'P';
end;

procedure TForm1.OnMouseEnter(Sender: TObject);
begin
Caption := Caption + 'E';
end;

procedure TForm1.OnMouseLeave(Sender: TObject);
begin
Caption := Caption + 'L';
end;

end.

**********

Kind regards
Lars Nebel

Re: OnClickPointer event problems

Posted: Tue Jun 08, 2010 11:17 am
by yeray
Hi Lars Nebel,

You are right, as you say, activating the events OnMouseEnter or OnMouseLeave, makes the event OnClickPointer to be fired many times, when the mouse is mover over any point, not only clicking on them. I've added it to the defect list to be fixed in future releases (TV52014945).