Recent

Author Topic: [solved] How to get OnClick event for TTitleFootClickTool  (Read 1845 times)

Muso

  • Sr. Member
  • ****
  • Posts: 356
[solved] How to get OnClick event for TTitleFootClickTool
« on: April 17, 2021, 05:02:17 am »
I need the new features TTitleFootClickTool and TLegendClickTool. So I got the latest Laz 2.1 via fcupdeluxe.

In my chart I have set the TChartToolset which contains TTitleFootClickTool . But when I click at runtime at the title of the chart, the OnClick event is not triggered. The same is for the legend.
To test I added to the TChartToolset a data crosshair tool and there e.g. the OnDraw event is correctly triggered.

As next test I added a DataPointClickTool. But there the OnPointClick is also not triggered on clicking on a data point on the chart.

Therefore I am a bit lost. Do I have to do something special to trigger the click events?
« Last Edit: April 17, 2021, 07:33:12 pm by Muso »

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: How to get OnClick event for TTitleFootClickTool
« Reply #1 on: April 17, 2021, 02:26:32 pm »
There is a charteditor demo in folder components/tachart/demo/charteditor of the trunk TAChart installation; it excessively uses the new chart tools. https://wiki.lazarus.freepascal.org/TAChart_Demos#charteditordemo

When chart tools do not work as expected the problem is usally that the TChartToolset component is not linked to the Tools property of the chart.

AL

  • Sr. Member
  • ****
  • Posts: 261
Re: How to get OnClick event for TTitleFootClickTool
« Reply #2 on: April 17, 2021, 05:48:25 pm »
Do not forget to set the "SHIFT" property for the Tool.   For a regular mouse click set it to left.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: How to get OnClick event for TTitleFootClickTool
« Reply #3 on: April 17, 2021, 07:32:57 pm »
When chart tools do not work as expected the problem is usally that the TChartToolset component is not linked to the Tools property of the chart.

many thanks! However, this was not the problem, I found now out that since I also have a ZoomDragTool set to shift state "ssLeft" AND my legend is inside the axis, the ZoomDragTool got the clicks. So I now simply changed the order in the TChartToolset and now everything works.

Besides this, the LegendClick tool is amazing!

 

TinyPortal © 2005-2018