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
OnClickPointer event problems
Re: OnClickPointer event problems
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).
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).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |