OnClickPointer event problems

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
lnebel
Newbie
Newbie
Posts: 1
Joined: Thu Apr 22, 2010 12:00 am

OnClickPointer event problems

Post by lnebel » Tue Jun 08, 2010 6:34 am

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

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

Re: OnClickPointer event problems

Post by Yeray » Tue Jun 08, 2010 11:17 am

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).
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