Page 1 of 1

Cursor Tool Snap Change misses manual changes to XValue

Posted: Tue Jun 14, 2005 7:52 pm
by 9333098
A vertical Cursor Tool's OnSnapChange event does not fire if the cursor tool's X value has been changed programmatically and the next mouse movement is then back to the XValue the cursor tool was at before its XValue was changed.

Fill a line series with 10 values (FillSampleValues) so its X axis goes from 0 to 9.
Add a CursorTool with Snap true and FollowMouse true.
In the CursorTool's OnSnapChange event, display GetTickCount on a label so this event's firing can be detected.
Move the mouse to position the cursor at X=8 and move the mouse off the chart.
Click a button configured to set the cursortool's XValue = 1
The cursor will move to X=1
Now move the mouse back onto the chart at location X = 8. The cursor moves from X=1 to X=8 but the OnSnapChange event does not fire.

It seems as though manual changes to the cursortool's XValue are not passed onto whatever parameter the OnSnapChange method is comparing to. Any way to get this to happen ?

Posted: Wed Jun 15, 2005 8:43 am
by narcis
Hi Steve,

It works fine here following your instructions, using latest TeeChart sources and this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(10);
  GetTickCount:=0;
end;

procedure TForm1.ChartTool1SnapChange(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
  inc(GetTickCount);
  Chart1.Title.Text[0]:=IntToStr(GetTickCount);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ChartTool1.XValue:=1;
end;
If you want I can send you the complete application for you to test it.

Posted: Thu Jun 16, 2005 1:24 pm
by 9333098
Narcis,

Are you moving the mouse on the chart to X=8 so the cursor gets positioned there, then moving the mouse vertically off the chart so the cursor remains at X=8. Then click the buton to programmatically change the XValue=1. Then move the mouse (still off the chart) so it is aligned above or below the chart at the chart's X=8 position. Then move the mouse to re-enter the chart at X=8 ? When I re-enter at X=8, the OnSnapChange event does not fire. If I re-enter at another X value, it does fire. TChart 7.04

Steve

Posted: Mon Jun 20, 2005 11:02 am
by narcis
Hi Steve,

I've been able to reproduce this problem here and has already been fixed to be included at the next maintenance release.