Detect doubleclick

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Ewestenend
Newbie
Newbie
Posts: 2
Joined: Mon Aug 02, 2010 12:00 am

Detect doubleclick

Post by Ewestenend » Mon Oct 25, 2010 6:40 am

Hi,

The legend is active and I have a TLegendScrollBar in it.
Due the fact I want to be able to use the charts doubleclick event for navigation issues, I need to know where the users performs a doubleclick within the chartarea.
Meaning. If a user doubleclicks within the legendarea nothing should happen and by double clicking in the chartarea and not in the legendarea I call some code.
How can I detect where a doubleclick occurs?

Thanks,
Eric.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Detect doubleclick

Post by Narcís » Mon Oct 25, 2010 9:33 am

Hi Eric,

You can use OnMouseDown event combined with OnDblClick and PointInRect method, for example:

Code: Select all

var
  Form1: TForm1;
  XPos : Integer;
  YPos : Integer;

implementation

{$R *.dfm}

uses TeCanvas;

procedure TForm1.Chart1DblClick(Sender: TObject);
begin
  if PointInRect(Chart1.ChartRect, XPos, YPos) then
    Chart1.Title.Text[0]:='Chart area clicked'
  else
    Chart1.Title.Text[0]:='no click';
end;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  XPos:=X;
  YPos:=Y;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply