Recent

Author Topic: Converted from Delphi, forms screwed :(  (Read 436 times)

Prime

  • Jr. Member
  • **
  • Posts: 62
Converted from Delphi, forms screwed :(
« on: March 21, 2023, 05:46:27 pm »
Hi All,

I've converted a copy of my GUI apps from Delphi 7 -> Lazarus now and both have ended up with slightly screwed components after conversion.

For example, the attached file, Right hand screenshot is how it appears in Delphi (or when executed from Delphi), Left hand is how it appears in Lazarus :(

Any idea why this is happening?

It may be related to the fact that my monitor is a 4K, so native 3840x2160, but running at 150% zoom, so effective resolution of 2560x1440.

Cheers.

Phill.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1396
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Converted from Delphi, forms screwed :(
« Reply #1 on: March 21, 2023, 06:00:44 pm »
Any idea why this is happening?
I assume that it is just the wrong font + font-size being used.
Try set size to 9 and play with different fonts to find a good one that matches.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1396
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Converted from Delphi, forms screwed :(
« Reply #2 on: March 21, 2023, 06:03:53 pm »
and disable themes in project options, your delphi 7 file looks like that it aint uses system theme
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

AlexTP

  • Hero Member
  • *****
  • Posts: 2117
    • UVviewsoft
Re: Converted from Delphi, forms screwed :(
« Reply #3 on: March 21, 2023, 06:57:59 pm »
Why 'try different fonts'? Use the 'Default' font which is auto-detection for current OS font.
And yes, fix all font size by replacing it in *.lfm.

And play with "Scaled" property in *.lfm.

EDIT
I looked in my forms, did not find neither "Scaled" nor "Font" in some forms - so delete them.
« Last Edit: March 21, 2023, 07:00:27 pm by AlexTP »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 1396
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Converted from Delphi, forms screwed :(
« Reply #4 on: March 21, 2023, 07:08:42 pm »
Why 'try different fonts'? Use the 'Default' font which is auto-detection for current OS font.
Because Delphi 7 not use autodetected system font. It was "ms shell dlg" or "ms shell dlg 2"... something like that.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

wp

  • Hero Member
  • *****
  • Posts: 10851
Re: Converted from Delphi, forms screwed :(
« Reply #5 on: March 21, 2023, 07:24:05 pm »
I guess that LCL scaling causes this issue. Maybe not the simplest way to handle this, but I'd do the conversion only on a system running at 96ppi - there are too many unknowns... You do not need another computer for this purpose, you could create another user account on your system as well and run this at 100% resolution (96ppi). Your Lazarus installation should be reachable by both users. So, in order to convert a D7 form to Lazarus log in as this new user and do the conversion. When everything is converted activate LCL scaling in the converted project and log in as the normal user. When you now open the project at 150% everything should be scaled up. But no guarantee, always keep a backup of the original (=untouched by Lazarus) version of the project so that you can repeat the conversion if somethis goes wrong.

Prime

  • Jr. Member
  • **
  • Posts: 62
Re: Converted from Delphi, forms screwed :(
« Reply #6 on: March 27, 2023, 10:50:00 pm »
Right having got the project converted correctly, I've done some more investigating.....

Note these are all loading the same project, after conversion.

I've ported to build / compile on Linux, on a machine running at 2560x1600, and 100% scaling, that displays the boxes OK. The Design PPI and PPI are both detected as 96.
With my windows setup of 3840x2160, scaled as 150%, Lazarus screws the form up on loadin and sets Design PPI to 96, and PPI to 144.

So I set windows to the same resolution as Linux, with 100% scaling and re-loaded, that was OK, DPPI=96, PPI=96
With Windows running at 3840x2160, but 100% scaling, again things where OK, DPPI=96, PPI=96

So it seems to be the IDE detecting the windows scaling and screwing things up, on *LOADING* the form rather than at conversion time.
Can this behavior be turned off perhaps?

Cheers.

Phill.


 

TinyPortal © 2005-2018