Page 1 of 1

[Solved] TDragPointTool - Cancel dragging

Posted: Wed Aug 29, 2007 4:03 pm
by 9346283
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.

Posted: Thu Aug 30, 2007 8:45 am
by narcis
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;

Posted: Thu Aug 30, 2007 5:37 pm
by 9346283
Hi NarcĂ­s,

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

Cheers :)

Jorge.