Recent

Author Topic: Lazarus 4 and TAChart Hint Tool  (Read 1518 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1308
Lazarus 4 and TAChart Hint Tool
« on: July 05, 2025, 04:07:36 pm »
To my code I did a lot of nasty things. I changed its parent and I upgraded from Lazarus 3.0 to Lazarus 4.0.
I still work with Windows 7.

The TACharts seem to have moved quite fine.
However my hints are not displayed any more.  Doubleclick on the chart shows e.g. "cross hair", however there are no outputs at runtime.

Here is an example how the code looks alike, which has worked in my former environment:

Code: Pascal  [Select][+][-]
  1. // gibt das Datum in einem kleinen Zusatzfenster im Chart aus und den geklickten Punkt der mouse-over Serie
  2. procedure TFrame_Bacora.Hint_bacoHint(ATool: TDataPointHintTool; const APoint: TPoint; var AHint: String);
  3. var ser: TChartSeries;
  4.     punkt: Integer;
  5. begin
  6.   ser:=nil;
  7.   if ATool.Series is TChartSeries
  8.        then begin
  9.          ser := TChartSeries(ATool.Series);
  10.          punkt := ATool.PointIndex;
  11.            end;
  12.  
  13.   if ser <> nil
  14.      then AHint := DateToStr(ser.GetXValue(punkt)) +'  ' + FloatToStr(ser.GetYValue(punkt))
  15.      else  AHint := '';
  16. end;
  17.  
  18. // verschiebt das Ausgabefenster vom Mauscursor weg
  19. procedure TFrame_Bacora.Hint_bacoHintLocation(ATool: TDataPointHintTool;
  20.   AHintSize: TSize; var APoint: TPoint);
  21. begin
  22.    APoint.Y := APoint.Y - AHintSize.CY;
  23. end;

CM630

  • Hero Member
  • *****
  • Posts: 1679
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Lazarus 4 and TAChart Hint Tool
« Reply #1 on: July 05, 2025, 10:19:21 pm »
Just shooting in the dark - the hints are disabled by default for most Lazarus components, maybe you have to enable yours.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

wp

  • Hero Member
  • *****
  • Posts: 13491
Re: Lazarus 4 and TAChart Hint Tool
« Reply #2 on: July 05, 2025, 11:23:33 pm »
The code in the snippet seems to be correct.

I could imagine the following scenarios which prevent the popup hint from appearing:
  • The ChartToolset is no longer linked to the Chart.Tools property.
  • The code in procedure TFrame_Bacora.Hint_bacoHint is no longer assigned to the DataPointHintTool's OnHint event.
  • You incidentally changed the Shift property of the DataPointHintTool. Normally Shift is an empty set here, meaning that it is enough to just move the mouse over a data point to see the hint.
  • The DataPointHintTools's AffectedSeries property is not empty or does not contain the index of the series at which the tool should become active.
  • The property Enabled has been switched to False

It is not necessary to set the Chart's ShowHint property to true in order to see the datapoint hints.

Nicole

  • Hero Member
  • *****
  • Posts: 1308
Re: Lazarus 4 and TAChart Hint Tool
« Reply #3 on: July 08, 2025, 05:13:38 pm »
Sure, the code is correct, - you wrote it.  :D

Thank you for your answer.
I checked all of those points and all positive.
And now the surprise: It works again. I have not changed anything!
Maybe just the clicking at the items re-did something which was broken.

I watch such effects before.
completely different thing:

e.g. I added an imagelist to a TPageControl.
Then I add images to the tabsheets. Leave it alone for long.
One day: all gone. I ask myself: Haven't I checked the icons there? - Did I miss this?
I see - no imagelist.
After having added it: The tabsheet icons re-appear "by themselves".

 

TinyPortal © 2005-2018