Recent

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

Muso

  • Jr. Member
  • **
  • Posts: 92
[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: 8347
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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

AL

  • Full Member
  • ***
  • Posts: 225
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 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

Muso

  • Jr. Member
  • **
  • Posts: 92
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