Recent

Author Topic: [Solved] TaChart unZoom on dbl-click only  (Read 3095 times)

Marq01

  • New Member
  • *
  • Posts: 19
[Solved] TaChart unZoom on dbl-click only
« on: January 01, 2025, 12:27:11 pm »
Is it possible to change the Chart unZoom function from left mouse click to a left-mouse double click?
The reason is that if you on accident left click you loose all the zooming and panning.
I looked into the zoomdragtool but could not find a logic place to intercept the mouse click.
Any hint is appreciated.

« Last Edit: January 02, 2025, 03:11:11 pm by Marq01 »

wp

  • Hero Member
  • *****
  • Posts: 12607
Re: TaChart unZoom on dbl-click only
« Reply #1 on: January 01, 2025, 05:53:05 pm »
  • Add a TChartToolset component to the form, assign it to the Tools property of the chart. This deactivates the built-in drag tool.
  • Add a TZoomDragTool to the Toolset. Check the ssLeft element of the Shift property. In RestoreExtentOn uncheck the element zreClick so that the dragtool no longer sees the single click to unzoom
  • Add a TUserDefinedTool to the Toolset. Check the elements ssDouble and ssLeft in its Shift property. Add the following code to the OnAfterMouseDown event of the tool
Code: Pascal  [Select][+][-]
  1. procedure TForm1.ChartToolset1UserDefinedTool1AfterMouseDown(ATool: TChartTool;
  2.   APoint: TPoint);
  3. begin
  4.   Chart1.ZoomFull;
  5. end;

Marq01

  • New Member
  • *
  • Posts: 19
Re: [Solved] TaChart unZoom on dbl-click only
« Reply #2 on: January 02, 2025, 03:12:10 pm »
Thanks WP.
Learned also how to use the Userdefined tool now.

 

TinyPortal © 2005-2018