Problem at the activation of TNearestTool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Problem at the activation of TNearestTool

Post by franckgar » Thu Jul 21, 2005 2:05 pm

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
franckgar

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 21, 2005 5:52 pm

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;

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Fri Jul 22, 2005 7:21 am

The problem is corrected with your trick.
Thanks

Franck

Post Reply