Recent

Author Topic: Create failed for form containing a TChart  (Read 8067 times)

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Create failed for form containing a TChart
« Reply #15 on: November 13, 2017, 10:46:17 am »
I would tentatively suggest that it could be better for the TAGraph code to explicitly designate parameters as "ansistring" rather than the ambiguous "string", though there may be good reasons for specifying string which I do not realise.
Absolutely not.  It would limit applicability of TAChart.

My conclusions:
  Do not mess with the Lazarus defaults of {$mode objfpc}($H+} without good reason and serious thought.
  Do not trust the global compiler H+ setting.
  Br grateful for the forum support when in the depths of an intractable and obscure bug.
I would add a forth one: Don't play with the string type. If you need shortstrings for some reasons (and your case is a valid one) then you should mark them as such (var s: String[255]) instead of modifying the general string type. As much as possible, avoid all the string variations such as ansistring, utf8string, unicodestring, widestring unless you absolutely know what your are doing. Plain old "string" will cover more than 90% of all programming needs.

mtanner

  • Sr. Member
  • ****
  • Posts: 287
Re: Create failed for form containing a TChart
« Reply #16 on: November 13, 2017, 12:31:18 pm »
Just to add a minor clarification. I was not messing with string types, I would not dream of redefining a system-defined data type.  The confusion over string types arose because, inadvertently, the H+ option became ineffective in my form units. That led to a conflict in the definition of OnMarkToText parameters, and an access error, not actually during the Create for the form, but in the call to OnMarkText when the chart was created.

I do always explicitly specify shortstring when that is what I want.  I never use "string", partly because the string variables I need to define myself are, so far, well enough handled as shortstring, and partly because ambiguity in meaning of definitions makes me nervous.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Create failed for form containing a TChart
« Reply #17 on: November 13, 2017, 05:10:42 pm »
Marathon effort, well done on finally nailing it! :-)

Many thanks for the information sharing as well.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

 

TinyPortal © 2005-2018