How to detect user double click on x axis area or Y axis are
Posted: Mon Sep 26, 2005 8:52 am
How to detect if user double click on x axis area or Y axis area?
Any event I can use?
Thank you
Any event I can use?
Thank you
Steema Software - Customer Support Forums
http://216.92.243.79/support/
Yes, but it's easier with some events which already provide mouse coordinates on their arguments list.ummm but I want to detect it on double click event instead of just clicking.
Yes, you can do something like:And clickaxis seems to be work when i click precisely on the axis line, what if i click on area near the axis line (outside the axis for sure, not inside) but still have the same effect. Possible?
Code: Select all
procedure TForm1.Chart1DblClick(Sender: TObject);
var
Top,Bottom,Left,Right: Integer;
MousePos: TPoint;
begin
Top:=Chart1.Axes.Left.IStartPos;
Bottom:=Chart1.Axes.Left.IEndPos;
Left:=Chart1.Axes.Left.PosAxis-30;
Right:=Chart1.Axes.Left.PosAxis;
MousePos:=Chart1.GetCursorPos;
if ((MousePos.X>=Left) and (MousePos.X<=Right) and
(MousePos.Y>=Top) and (MousePos.Y<=Bottom)) then
Chart1.Title.Text[0]:='Left Axis Clicked!'
else Chart1.Title.Text[0]:= IntToStr(Top)+', ' +
IntToStr(Bottom)+', ' +
IntToStr(Left)+', ' +
IntToStr(Right);
end;
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Top,Bottom,Left,Right: Integer;
begin
Top:=Chart1.Axes.Left.IStartPos;
Bottom:=Chart1.Axes.Left.IEndPos;
Left:=Chart1.Axes.Left.PosAxis-30;
Right:=Chart1.Axes.Left.PosAxis;
if ((X>=Left) and (X<=Right) and (Y>=Top) and (Y<=Bottom)) then
Chart1.Title.Text[0]:='Left Axis Clicked!'
else Chart1.Title.Text[0]:= IntToStr(Top)+', ' +
IntToStr(Bottom)+', ' +
IntToStr(Left)+', ' +
IntToStr(Right);
end;