Page 1 of 1

Problem at the activation of TNearestTool

Posted: Thu Jul 21, 2005 2:05 pm
by 9339785
Hi,
I found a problem at the activation of TNearestTool.
I'm using this tool like this : when the key CTRL is down the tool TNearestTool is activated, and when the key CTRL is up the tool TNearestTool is hidden.
A problem appears when I push the key CTRL without moving the mouse. The position found by the function GetNearestPoint is good but the line which is drawn between the mouse and the point is not visible or in a wrong position.
Of course as soon as the mouse is moved the problem is corrected but the effect is very disagreeable.

Do you have a solution to correct this bug ? I try with the functions Repaint of the graph and the tool but without success.
Thanks
Franck

Posted: Thu Jul 21, 2005 5:52 pm
by Pep
Hi Franck,

you can use the following trick :

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  ChartTool1.Active:=not ChartTool1.Active;
  SetCursorPos(Mouse.CursorPos.X,mouse.CursorPos.Y);  // trick
end;

Posted: Fri Jul 22, 2005 7:21 am
by 9339785
The problem is corrected with your trick.
Thanks

Franck