Page 1 of 1

TCursorTool - Click Tolerance and movement

Posted: Tue Jun 10, 2008 6:35 am
by 9349911
Hi !

We use TCursorTools for measurement purpose. We calculate the x / y differences between two cursortools -> dx/dy.

This works nice but I have a problem with the clicktolerance. By default this is set to the value 3. If you move the cursor tool over the other cursor tool it hangs for a short while. And you canĀ“t place the one cursortool over another one.

If you set Clicktolerance to 0 all works fine. But then you have a problem to "catch" the lines for moving.

So is there any way to disable the line "bouncing" if you use a clicktolerance > 0?

Posted: Tue Jun 10, 2008 8:52 am
by yeray
Hi Dominik,

I suggest you to force the ClickTolerance of the non clicked cursor to 0 when dragging. And restore the default (3) when finish dragging.

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if ChartTool1.Clicked(X,Y) = ccBoth then
  begin
    ChartTool1.ClickTolerance := 3;
    ChartTool2.ClickTolerance := 0;
  end;

  if ChartTool2.Clicked(X,Y) = ccBoth then
  begin
    ChartTool1.ClickTolerance := 0;
    ChartTool2.ClickTolerance := 3;
  end;
end;

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