[Solved] TDragPointTool - Cancel dragging

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jorge Z
Newbie
Newbie
Posts: 2
Joined: Fri May 12, 2006 12:00 am

[Solved] TDragPointTool - Cancel dragging

Post by Jorge Z » Wed Aug 29, 2007 4:03 pm

Hi,
I have a fast line serie with a drag point tool asociated to it and I would like to allow only de last point of the series to be dragged, not just any point of it.
I am using the event OnDragPoint of the tool to capture the point being dragged and in the OnMouseUp event of the TChart I do the rest.

Is there any way to "cancel" or "undo last drag" if the dragged point is not the last one?. I can't realise how to do that.

Thanks in advance.

Edit: I am using TeeChart 7.0 Source Code.
Last edited by Jorge Z on Thu Aug 30, 2007 5:41 pm, edited 1 time in total.

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

Post by Narcís » Thu Aug 30, 2007 8:45 am

Hi Jorge,

The easiest way to only allow dragging of the last point is using chart's OnMouseDown and OnMouseUp event for only activating the tool for the last point in the series:

Code: Select all

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ChartTool1.Active:=true;
end;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (Series1.Clicked(X,Y)<>Series1.Count-1) then
    ChartTool1.Active:=false;
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

Jorge Z
Newbie
Newbie
Posts: 2
Joined: Fri May 12, 2006 12:00 am

Post by Jorge Z » Thu Aug 30, 2007 5:37 pm

Hi Narcís,

thanks for the reply. That advice helped me to do the "trick".

Cheers :)

Jorge.

Post Reply