Recent

Author Topic: [solved] Invalid Typecast exception in charteditor demo  (Read 394 times)

Muso

  • Jr. Member
  • **
  • Posts: 90
[solved] Invalid Typecast exception in charteditor demo
« on: April 17, 2021, 11:32:21 pm »
There is a bug in the TAChart demo "charteditor":

- run the program using Laz 2.1dev
- click onto the title of an axis
- in the appearing dialog do nothing but pressing OK
- now click on the chart title

result: Invalid Typecast exception, see the attached screenshot.

-------------

When this is fixed, could line 89 of ceLegendDlg.pas please be changed to
Code: Pascal  [Select][+][-]
  1. LegendEditor: TLegendEditor;
because the current
Code: Pascal  [Select][+][-]
  1. AxisTitleEditor: TLegendEditor;
is misleading.

The same for line 52 of ceTitleFootDlg.pas where it should be
Code: Pascal  [Select][+][-]
  1. TitleFootEditor: TTitleFootEditor;
instead of
Code: Pascal  [Select][+][-]
  1. AxisTitleEditor: TTitleFootEditor;
« Last Edit: April 18, 2021, 07:09:59 pm by Muso »

wp

  • Hero Member
  • *****
  • Posts: 8394
Re: Invalid Typecast exception in charteditor demo
« Reply #1 on: April 18, 2021, 10:50:33 am »
Done. Thanks for reporting.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: Invalid Typecast exception in charteditor demo
« Reply #2 on: April 18, 2021, 03:33:55 pm »
Many thanks for the fix!

There are now only two minor things: When compiling the demo I get these compiler messages:

Code: Pascal  [Select][+][-]
  1. Compile Project, Target: charteditordemo.exe: Success, Hints: 6
  2. ceaxisdlg.pas(181,14) Note: Call to subroutine "function TChartAxis.GetMarks:TChartAxisMarks;" marked as inline is not inlined
  3. ceaxisdlg.pas(212,16) Note: Call to subroutine "function TChartAxis.GetMarks:TChartAxisMarks;" marked as inline is not inlined
  4. ceaxisdlg.pas(291,14) Note: Call to subroutine "function TChartAxis.GetMarks:TChartAxisMarks;" marked as inline is not inlined
  5. ceaxisdlg.pas(338,12) Note: Call to subroutine "function TChartAxis.GetMarks:TChartAxisMarks;" marked as inline is not inlined
  6. ceaxisdlg.pas(382,14) Note: Call to subroutine "function TChartAxis.GetMarks:TChartAxisMarks;" marked as inline is not inlined
  7. cetitlefootdlg.pas(63,23) Hint: Local type "TChartTitleAccess" is not used
  8.  

What does "marked as inline is not inlined" mean and how can this be fixed?
(I could filter these messages but then I also loose the hints I want to see for my project.)

Thaddy

  • Hero Member
  • *****
  • Posts: 10784
Re: Invalid Typecast exception in charteditor demo
« Reply #3 on: April 18, 2021, 03:40:41 pm »
Inline is a request to the compiler to try to inline a certain routine. The compiler can decide that a routine is too complex - or slower - to inline. Hence the compiler informs you that it can not inline. It is a hint. Not a warning or error. Your code is not affected.
« Last Edit: April 18, 2021, 03:43:40 pm by Thaddy »

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: Invalid Typecast exception in charteditor demo
« Reply #4 on: April 18, 2021, 03:44:58 pm »
Inline is a request to the compiler to try to inline a certain routine. The compiler can decide that a routine is too complex to inline. Hence the compiler informs you that it can not inline. It is a hint. Not a warning or error.

Thanks.
The point is I know that it is only a hint but I use now the new TAChart tools in my project and get these hints. Filtering out all hints, however will filter out the hints I want to see. Therefore it would help me to know what I have to do to silence the compiler, making the routine less complex.

wp

  • Hero Member
  • *****
  • Posts: 8394
Re: Invalid Typecast exception in charteditor demo
« Reply #5 on: April 18, 2021, 05:21:23 pm »
You could open the TAChart package file (TAChartLazarusPkg.lpk in components/tachart) > "Options" > "Compiler Options" > "Messages" and type "inline" in to filter box at the top. One of the remaining messages is "Note: Call to subroutine "$1" marked as inline is not inlined". When you remove the checkmark and rebuild the IDE, all these warnings will be gone. You will have to repeat the same with the project.

The reason why this is not done in the official sources is that trunk must compile also with FPC 3.0.4, but this version chokes on the corresponding change in the lpk file and then refuses to build the IDE...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: Invalid Typecast exception in charteditor demo
« Reply #6 on: April 18, 2021, 05:39:50 pm »
You could open the TAChart package file (TAChartLazarusPkg.lpk in components/tachart) > "Options" > "Compiler Options" > "Messages" and type "inline" in to filter box at the top...

Many thanks!

However, could you please do the little change to silence this compiler warning:
Code: Pascal  [Select][+][-]
  1. cetitlefootdlg.pas(63,23) Hint: Local type "TChartTitleAccess" is not used

wp

  • Hero Member
  • *****
  • Posts: 8394
Re: Invalid Typecast exception in charteditor demo
« Reply #7 on: April 18, 2021, 05:43:10 pm »
Yes, already done. And I also removed each "inline" hint from the charteditor demo individually by using the {%H} directive
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: Invalid Typecast exception in charteditor demo
« Reply #8 on: April 18, 2021, 07:09:48 pm »
Yes, already done. And I also removed each "inline" hint from the charteditor demo individually by using the {%H} directive

Many thanks! I got these inline messages also on other occasions and know now how to silence them.

 

TinyPortal © 2005-2018