Forum > Databases

Strange IDE behavior at code location

(1/2) > >>

davec:
Hello everyone,

I am new to Lazarus and Delphi and have a strange behavior in my project.

It is about the following place in the code (mainmenu.pas):

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---frmDatenEinlesen.DataExchange := Self; 
After I execute the program in the IDE and confirm the "Insert new Data" button in the "mainmenu.lfm", the program exits (without a debug message) and I end up in the source code view. However, as soon as I compile the program and execute the EXE file, everything works perfectly.

What is the reason for this? Do you have a solution for this?

I have attached the project.
The sqlite3.dll must be inserted in the program directory for correct program execution (unfortunately only ZIPS up to max. 500 KB are allowed here, otherwise I would have already inserted it): https://www.sqlite.org/download.html (sqlite-dll-win-x64-3450300.zip)

Many thanks for your help!

Best regards
Dave

Martin_fr:
I am not currently going to run it on my machine, but a few ideas....


--- Quote ---the program exits (without a debug message) and I end up in the source code view.
--- End quote ---
Just to double check
- the IDE title no longer says "debugging"?
- the blue dots in the editor-gutter disappear?


Menu: View > debug windows > event log
When the app ends, does it say anything in the event log window?


Menu: Tools > Option / Debugger > Backend
Have you tried FpDebug and/or GDB based backends?


Have you set a breakpoint on that line, and then stepped in with F7?



Have you compiled both (the "debugging" and "run outside the IDE") with the same settings?

cdbc:
Hi
OK, so I've got your program running in my laz 2.2.6, debugging, doesn't matter that it's on linux  :D
Right so what exactly is your problem?!?
Regards Benny

davec:
@Martin_fr

Thank you!

1. the IDE title says still "debugging..."
2. the blue dots in the editor-gutter are already there.
3. the event log is empty

4. i changed the debugger backend from FpDebug to GDB.

Now it works flawlessly! What could be the reason? Why does it not work with FpDebug?

@cdbc
In FpDebug, the application exits in the middle of execution. I am using Windows 10 with Lazarus 3.2.
I have attached a screenshot.

@all
I have another problem


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFormDatenEinlesen.AnalyzeDataSorting(const Data: TStringList) string;var  I: Integer;  Ascending, Descending, PartiallySorted: Boolean;begin  if Data.Count = 0 then    Exit('No data available for analysis.');   Ascending := True;  Descending := True;  PartiallySorted := False;   // Check for complete sorting  for I := 0 to Data.Count - 2 do  begin    if Data[I] > Data[I+1] then      Ascending := False;    if Data[I] < Data[I+1] then      Descending := False;  end;   if Ascending then    Exit('Already sorted: ascending');  if Descending then    Exit('Already sorted: descending');    // Check for partial sorting  for I := 0 to Data.Count - 3 do // Attention: Change to Data.Count - 3 to avoid index errors   begin     if (Data[I] <= Data[I+1]) and (Data[I+1] <= Data[I+2]) then       PartiallySorted := True;     else if (Data[I] >= Data[I+1]) and (Data[I+1] >= Data[I+2]) then       PartiallySorted := True;   end;   if PartiallySorted then    Exit('Partially sorted');   Result := 'Randomly distributed';end;    


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit FormDatenEinlesen; interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, DB,  SQLite3Conn, SQLDB, IDataExchange; type  { TFormDatenEinlesen }  TFormDatenEinlesen = class(TForm) ...  private ...    function AnalyzeDataSorting(const Data: TStringList): string;    
Where did I make the mistake?

The debugger tells me:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---formdateneinlesen.pas(110,74) Error: Syntax error, ";" expected but "STRING" found
on this line:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFormDatenEinlesen.AnalyzeDataSorting(const Data: TStringList) string;  
Thank you!

Regrads
Dave


 



cdbc:
Hi

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit FormDatenEinlesen; interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, DB,  SQLite3Conn, SQLDB, IDataExchange; type  { TFormDatenEinlesen }  TFormDatenEinlesen = class(TForm) ...  private ...    function AnalyzeDataSorting(const Data: TStringList): string;    ////////////////////////////////////////////////////////////////////    procedure TFormDatenEinlesen.AnalyzeDataSorting(const Data: TStringList) string;    ?????????///////////////////////////////////////////////??????????<:>????  Well Duh!!!
Regards Benny

Navigation

[0] Message Index

[#] Next page

Go to full version