Recent

Author Topic: Lazarus Release 4.0  (Read 74184 times)

calebs

  • Full Member
  • ***
  • Posts: 202
Re: Lazarus Release 4.0
« Reply #120 on: May 21, 2025, 12:26:09 am »
Hello all! i use fpcupdeluxe to install fixes branch of 4.x rc's and now i've downloaded and installed 4.1 with fpc 3.2.2 and this function
Code: Pascal  [Select][+][-]
  1. function esnumeroent(cade: string; var nro: integer): boolean;
  2. var
  3.   nrot: real;
  4.   cod: integer;
  5. begin
  6.   DefaultFormatSettings.DecimalSeparator := '.';
  7.   cade := comaapunto(cade);
  8.   cade := trim(cade);
  9.   nro := 0;
  10.   val(cade, nrot, cod);
  11.   if cod <> 0 then
  12.     esnumeroent := False
  13.   else begin
  14.     nro := trunc(nrot);
  15.     esnumeroent := True;
  16.   end;
  17. end;                
with previous versiones when i send "e42" for example it returned false but now
val evaluates the string "e42" with result 0 in nrot and 0 in cod so, this won't happen with previous 4 RC'S.
Any hint?

PascalDragon

  • Hero Member
  • *****
  • Posts: 6000
  • Compiler Developer
Re: Lazarus Release 4.0
« Reply #121 on: May 22, 2025, 08:49:05 pm »
Any hint?

Can you reduce this to a standalone example? There shouldn't be any difference, because Lazarus uses the same compiler version and the code in question is part of the RTL/compiler.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11292
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release 4.0
« Reply #122 on: May 22, 2025, 09:50:44 pm »
I don't know what "val" takes into account....

Like DefaultFormatsettings, or exception mask???

If you program uses any units that make any chages to something like this... Then that could explain it.

So what happens if you have a new simple program. No units used, just do the calculation and writeln to console?


Bart

  • Hero Member
  • *****
  • Posts: 5571
    • Bart en Mariska's Webstek
Re: Lazarus Release 4.0
« Reply #123 on: May 22, 2025, 10:32:44 pm »
This:
Code: Pascal  [Select][+][-]
  1. var
  2.   code: integer;
  3.   R:Real;
  4. begin
  5.   Val('e42',R, Code);
  6.   writeln('Code=',Code);
  7.   if (Code=0) then writeln('R=',R);
  8. end.
Outputs:
Code: [Select]
Code=0
R= 0.00000000000000E+0000
It does so with fpc 3.04, 3.2.0, 3.2.2 and fpc main (win32), and Delphi (7) does exactly the same.
('e42' is treated a '0E42', which is 0x10^42, which is zero)

This suggest that something else is going wrong in your example.
(What does commapunto do?
Why are you setting DefaultFormatSettings.DecimalSeparator to '.'? Val doesn't need that.)

calebs

  • Full Member
  • ***
  • Posts: 202
Re: Lazarus Release 4.0
« Reply #124 on: May 24, 2025, 10:02:56 pm »
hey guys, the function i've shared with VAL function it is used to verify that a string is a real number.
Its an old pascal procedure before new funcions as isfloatnumber() or newest do.
The value e42 is a random string i've writed, it could be 302.33.3 for example that is not a decimal number.
Before the final 4.0 release my function returns false if it is not a number relying on val function that the documentation says that the real number returned could be anything but the integer returns different to 0 (zero) when is not a real number but the problem now is that val procedure with this val('392.22,1',nr,ni) returns 0 or anything in nr but zero on ni when should be 3 or another value.
Resuming, that function was working from lazarus 0.9 to 3.x and first 4rc's but not now.
I could use new functions like isrealnumber but is so much code to trace on my programs.
It's for that i post this here, don't know if is a bug.
i have deleted 3.x but i will download again and try with that to test it.

Bart

  • Hero Member
  • *****
  • Posts: 5571
    • Bart en Mariska's Webstek
Re: Lazarus Release 4.0
« Reply #125 on: May 25, 2025, 12:24:18 am »
Since the working of Val() hasn't changed, it must be in your own code.
esnumeroent('392.22,1', nro) will return False as expected.
(Still don't know what comaapunto() function does though, so I commented that one out.)

If my assumption is correct that the function should return True if (and only if) the string represents a integer or a real number (why otherwise would you accept decimal separator in the string?), then:
  • It should accept 'e42' as a valid entry
  • It should crash when the floating point number is either greater than High(Integer), or less than Low(Integer): e.g. '2147483648' (if RangeChecking is on, otherwise the behaviour will be rather unpredictable).

Please post a working example (a console program we can compile) that shows a faulty output (e.g. it returns True for invalid input like '123.456,789').
ATM we only have a code snippet and it may very well be that the comaapunto() function is flawed.

And just to be clear: Lazarus 4.0 come by default with exactly the same compiler version as the 3.x versions (fpc 3.2.2).
This means that you use the exact same implementation of Val() in both versions.

Bart

Hansvb

  • Hero Member
  • *****
  • Posts: 816
Re: Lazarus Release 4.0
« Reply #126 on: June 04, 2025, 08:32:57 pm »
Hi,

Maybe the following is already known, but I just ran into this in the IDE. I had edited my project on another PC and then put it back on my own PC. Because one workplace has more monitors than the other, the left property of a TForm sometimes gets confused. In Lazarus 4 you can choose to use your ide undocked but leave your form docked. Then things go wrong if left has a strange value. It then seems as if all components of your form are gone. See attachement 'Left_is_wrong.png'. If you set the TForm's Left to 0 in the Object Inspector, the components will be visible again. See attachement 'Reset_Left.png'. So it is easy and quick to repair. But if you also set your form to undocked then a wrong left is no problem. See 'Wrong_left_form_is_ok.png'.

So not a question but something I ran into and perhaps someone might be able to take advantage of. It took me a few minutes before I realized what had happened.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11292
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release 4.0
« Reply #127 on: June 04, 2025, 08:51:16 pm »
The docked form editor (with or without Anchordocking) does indeed not work when the Top *OR* left of the form are negative.

That is a known issue (and I think there is a report for it). The problem is, that it likely needs deep changes at least to the LCL, possible down to the WS.

Hansvb

  • Hero Member
  • *****
  • Posts: 816
Re: Lazarus Release 4.0
« Reply #128 on: June 04, 2025, 09:13:13 pm »
The workaround is easy, adjust Left in the object inspector. And I probably won't be the last to run into it. That's why I put it here.

n7800

  • Sr. Member
  • ****
  • Posts: 337

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11292
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus Release 4.0
« Reply #130 on: June 05, 2025, 12:10:14 pm »
But if you also set your form to undocked then a wrong left is no problem. See 'Wrong_left_form_is_ok.png'.

Strange. If I do that on Windows, then the design form wont be visible.

If you are on Linux, then you might have a window manager that "corrects" this for you? (don't know)


Mind that -2300 can be valid. E.g. I have a multi monitor setup, and my left monitor has negative x coordinates.
« Last Edit: June 05, 2025, 12:14:00 pm by Martin_fr »

Nicole

  • Hero Member
  • *****
  • Posts: 1143
Re: Lazarus Release 4.0
« Reply #131 on: June 05, 2025, 04:19:21 pm »
Thank you so very much!
 :-* :-* O:-) O:-)

Please add something for somebody who has no idea of how to start.
I worked with Windows for 20 years. My Lazarus 3.0 runs at a Win 7 VM, which bothers me more and more by becoming outdated.
This I want to leave behind.

I want to migrate to a Linux Mint Cinnamon 22 or so-VM and Lazarus 4.
How to migrate?

For dummies:

1)
How to get Lazraus best into my Linux-VM?
The app-lists of my Linux overwhelmed me. There are hundreds of items, which I do not need.
What I need, I cannot find. And I do not find Lazarus.

2)
How to work with Firebird? My Linux offers me version 3.0.
As I work with 4 now, this will not work too fine.
I rather thought of changing to 5. How to do best?
Shall I upgrade Lazarus and Firebird together or each after the other?

3)
How to migrate my Lazarus 3 with all the components?
There is eg. IBX, TVplanit.
Will they work with 4 at sudden?
Or shall I just wait 3 months more?

4)
Is the code expected to migrate easily from 3 to 4 or is there anything which needs adjustment?


And last not least, I want to sort my environment better.
What do you think about this plan?
I do not like it at all. In Windows I would use c:\programs for the IDE, but there is no such a thing in Linux?

$HOME/
├── IDE/
│   ├── lazarus/             

├── Komponenten/
│   ├── myKomponenten/       


├── Bibliotheken/
│   └── units/               ← Allgemeine Units (z. B. string_helpers.pas)

├── Ressourcen/
│   ├── icons/               ← Icons, Logos etc.
│   └── fonts/               ← Schriftarten, evtl. später Audio, Video

├── Projekte/


└── geteilteDaten/    ← shared data





munair

  • Hero Member
  • *****
  • Posts: 879
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Lazarus Release 4.0
« Reply #132 on: June 09, 2025, 10:49:26 am »
If Lazarus and the FPC compiler packages are not in your Linux repository, you should be able to download the official packages and install them in the right order. That should work just fine. But you will probably have to adjust the GCC library version number to avoid (harmless) compilation warnings:
https://forum.lazarus.freepascal.org/index.php/topic,56114.msg417087.html#msg417087

You will have to install your components in the new Lazarus installation.

There should be enough information in the forum and elsewhere about how to install Lazarus on Linux distro's, including the required development packages.

This migration will take some work.

BTW, I also still use Windows 7 on two machines (no VM's) with Lazarus without any issues. I also have Lazarus on Debian 12 (Linux), which has (older) Lazarus and FPC packages in their repo by default. I don't know if Lazarus 4 works without issues on the latest Linux distro's if they don't have the packages in their repo by default. Manjaro, which is a stable rolling release distro, may offer Lazarus 4 soon, if it's not already in their repo.
It's only logical.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4571
  • I like bugs.
Re: Lazarus Release 4.0
« Reply #133 on: June 09, 2025, 03:28:30 pm »
I also recommend Manjaro or other rolling distro as a Linux system. They have the latest release versions of everything almost immediately. Some other distros can lag over a year behind.
My experience with Debian derivatives is that everything works as long as you use SW only from the distro's repository. When you install external packages, the system goes haywire at some point.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

AsleyCruz

  • Full Member
  • ***
  • Posts: 116
    • Graphic and web designer
Re: Lazarus Release 4.0
« Reply #134 on: June 09, 2025, 08:19:03 pm »
@mattias
Is this a bug on TCalendar control? Please, check out the attached animated gif.
Graphic & web designer

 

TinyPortal © 2005-2018