Things go bad when not using large strings while in objfpc mode. lazarus / 31-LCL ---------------------------------------------------------------------- jamie · 2025-06-15 19:50 case and point.  I had some old ported D code that used {$Mode Delph} with no  {$H+} afterwards.    However, switch to {$Mode ObjFpc}// no {$H+} afterwards and look at the following code example that you can try out. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}//Things go bad without {$H+} in objfpc mode. interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Grids; type   { TForm1 }   TForm1 = class(TForm)    DrawGrid1: TDrawGrid;    procedure DrawGrid1GetCellHint(Sender: TObject; ACol, ARow: Integer;      var HintText: String);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.DrawGrid1GetCellHint(Sender: TObject; ACol, ARow: Integer;  var HintText: String);begin  HintText := DateTimeTostr(Now);end; end.  Pay attention to the GetCellHint, there is when the crash takes place as soon as you assign the HintText with anything.  make sure you have the goCellHint in options and ShowHint checked in the OI.  This leads you to all kinds of random places each time you run it.   This does not happen while in {$Mode Delphi} with or without the {$H+} so I assume Delphi mode turns it on by default. jamie ---------------------------------------------------------------------- cdbc · 2025-06-15 20:13 Hi IIRC, long strings are the default in {$mode delphi}, whereas the default 'string' in {$mode objfpc} is _shortstring_, hence the need for {$H+}, 'cause in your example the "var HintText: String" is indeed in the LCL declared as a long string, thus the compiler whines about "a var parameter has to match the type exactly" or something like that... Regards Benny ---------------------------------------------------------------------- Bart · 2025-06-15 20:13 Well, the event signature requires an AnsiString, so you assigned an event with the wrong signature. IMO the IDE should warn about it, but ATM it cannot. (There are other exapmples about this around there somewhere in teh bugtracker.) You will see the error if you try to assign the event at runtime. Bart ---------------------------------------------------------------------- jamie · 2025-06-15 20:24 Quote from: cdbc on June 15, 2025, 10:13:06 pmHi IIRC, long strings are the default in {$mode delphi}, whereas the default 'string' in {$mode objfpc} is _shortstring_, hence the need for {$H+}, 'cause in your example the "var HintText: String" is indeed in the LCL declared as a long string, thus the compiler whines about "a var parameter has to match the type exactly" or something like that... Regards Benny There is no complaint from the compiler, it compiles and executes just fine, it's when you move the mouse over the grid is when the fun starts! Jamie ---------------------------------------------------------------------- Bart · 2025-06-15 21:05 There are no complaints, because the assignement of the event is done in the form, not in code. You can change the signature of the event (created by the IDE at design time) in the unit, and compilation will succeed. Below I asked the IDE to create an OnKeyPress event for a TEdit, but then I went ahead and changed the code to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   procedure Edit1KeyPress(Sender: TObject; var Key: String); This will compiles just fine, but obviously is dead wrong, and it will crash. The compiler cannot know (AFAIK), the IDE can, and it should warn about this, like Delphi does. So, this is a known bug/limitation of the Lazarus IDE. Bart ---------------------------------------------------------------------- Thaddy · 2025-06-16 09:33 Oh, well, Being stupid is an art, unless you were born stupid, like me..