Hi,
I use the mouse moving event to update a little text label to show the coordinates. But to get the coordinates x and y the ranges need to be setup already. This is not the case on program startup, so if the mouse cursor is (e.g. by chance) over the chart I get a runtime error.
To avoid this I created a boolean variable IsRun and use it in mouse-move event and initialize it in formcreate to False.
However, I still get the same crash. What to do?
Code:
procedure TFormMain.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Var xx, yy : Double;
begin
If IsRun then Begin
xx:=Chart1.XImageToGraph(X);
yy:=Chart1.YImageToGraph(Y);
LabelCursor.Caption:='Cursor: x=...';
end
end;
If I use If False all is fine....
Bye Stephan