Recent

Author Topic: HiDPI seems to corrupt my forms  (Read 804 times)

JD

  • Hero Member
  • *****
  • Posts: 1822
HiDPI seems to corrupt my forms
« on: January 19, 2021, 10:58:38 am »
Hi there everyone,

I'm having a problem with the forms in my project and I think it is due to HiDPI. I have Lazarus installed on various computers but my main development boxes are

a) my Windows 10 laptop which is full HD touch screen with 1920 x 1080 resolution
b) my Windows 10 desktop which has a normal 24 inch monitor with 1680 x 1050 resolution

I use the laptop when I'm on the road but I prefer to use the desktop when I'm at home because of the monitor size.

However I've discovered that when I work on some forms on my laptop, once I transfer to my desktop, Lazarus cannot open the form and it flickers while opening it, hangs and eventually shuts down Lazarus. This means I cannot transfer my work to my desktop. My project settings are in the attached screenshot.

Does anyone have an idea about how I can get around this nagging problem?

Thanks a lot,

JD
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

tetrastes

  • Jr. Member
  • **
  • Posts: 87
Re: HiDPI seems to corrupt my forms
« Reply #1 on: January 19, 2021, 02:27:46 pm »
Have you tried to set DPI awareness on?

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: HiDPI seems to corrupt my forms
« Reply #2 on: January 19, 2021, 03:16:08 pm »
What makes you believe that this is a High DPI issue? High DPI does not have anything to do with absolute screen resolutions, but with the pixel density (ppi) which is 96 by default but is increased on high-res monitor to avoid features becoming too small. You did not tell anything about the ppi on both systems.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #3 on: January 19, 2021, 03:19:24 pm »
What makes you believe that this is a High DPI issue? High DPI does not have anything to do with absolute screen resolutions, but with the pixel density (ppi) which is 96 by default but is increased on high-res monitor to avoid features becoming too small. You did not tell anything about the ppi on both systems.

DesignTimePPI = 96 I've never changed this setting
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: HiDPI seems to corrupt my forms
« Reply #4 on: January 19, 2021, 03:23:46 pm »
Then I can very safely say that this issue has nothing to do with High-DPI.

I think without seeing your sources nobody can give you a hint on what is wrong.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #5 on: January 19, 2021, 05:15:36 pm »
Then I can very safely say that this issue has nothing to do with High-DPI.

I think without seeing your sources nobody can give you a hint on what is wrong.

But how is it possible that the same project behaves differently on two different machines

machine a) no problems at all on FHD monitor
machine b) flickering form and crashing Lazarus IDE on normal monitor

The same version of Lazarus is installed on the two machines.  :( :( :(

JD
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: HiDPI seems to corrupt my forms
« Reply #6 on: January 19, 2021, 06:17:59 pm »
What makes you believe that this is a High DPI issue? High DPI does not have anything to do with absolute screen resolutions, but with the pixel density (ppi) which is 96 by default but is increased on high-res monitor to avoid features becoming too small. You did not tell anything about the ppi on both systems.

DesignTimePPI = 96 I've never changed this setting

Returning to this question: I mean the pixels per inch of the system: "Start" button > "Settings" (the gears icon) > "System" > first item, I think it is called "Display" > "Scaling and layout". The combobox tells me on my system: 100% (which is 96ppi)
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #7 on: January 19, 2021, 06:55:06 pm »
@wp

The laptop is on 150% while the desktop is on 100%. These are the recommended settings for the machines. See screenshots.

JD
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: HiDPI seems to corrupt my forms
« Reply #8 on: January 19, 2021, 07:52:50 pm »
OK, then my former statement that "this issue has nothing to do with High-DPI" could be wrong, although it is hard to believe.

When you switch the resolution of machine b) (the one with the problems) to match that of machine a), are the issues gone?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #9 on: January 24, 2021, 09:24:13 pm »
OK, then my former statement that "this issue has nothing to do with High-DPI" could be wrong, although it is hard to believe.

When you switch the resolution of machine b) (the one with the problems) to match that of machine a), are the issues gone?

Sorry for the late reply. I was away.  :D

When I increase the resolution of the screen on Machine b to 150% to match my laptop (Machine a) resolution, I am then able to open the form without problems. With the form open I then reset the resolution to 100% so that I can work on the form.

It is bizarre but that is the only way I can get it to work for now. But is there any other way to do this because it is ackward?  :(

JD

Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

jamie

  • Hero Member
  • *****
  • Posts: 4188
Re: HiDPI seems to corrupt my forms
« Reply #10 on: January 24, 2021, 11:31:18 pm »
is possible you are doing some screen graphics that is off screen due to the size changes ?

What you should do is create a simple do nothing single form app under the same conditions and then move that to the problem pc and then tell us how that works ?

  Its very possible a component in use or some graphic drawing is having issues with the resize calculations.
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: HiDPI seems to corrupt my forms
« Reply #11 on: January 25, 2021, 12:25:41 am »
Did you mention your lazarus version somewhere? LCL scaling requires at least v1.8.x, better 2.0.x+

For LCLscaling you must check the "Use LCL scaling" box in the project options, and on Windows you should switch "DPI awareness" to "on (true)" (if you have a second monitor you could also try the "Per Monitor" (PM) settings, but there were issues).

You should also make sure that "Force DPI scaling in designtime" is checked in the form editors options (right-click on form > Options).

With these settings I did a lot of experiments with loading and editing projects in Windows at several resolutions, and it always worked correctly.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #12 on: January 28, 2021, 01:04:33 pm »
is possible you are doing some screen graphics that is off screen due to the size changes ?

What you should do is create a simple do nothing single form app under the same conditions and then move that to the problem pc and then tell us how that works ?

  Its very possible a component in use or some graphic drawing is having issues with the resize calculations.

I'm not doing any screen graphics at all.

I'll investigate the components I use on the forms. That will take some work because it is not often obvious.

I remember a while ago, I reported that the Vampyre Imaging components stops the base Lazarus TImage from functioning correctly. So this suggestion is worth investigating.

JD
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

JD

  • Hero Member
  • *****
  • Posts: 1822
Re: HiDPI seems to corrupt my forms
« Reply #13 on: January 28, 2021, 01:07:02 pm »
Did you mention your lazarus version somewhere? LCL scaling requires at least v1.8.x, better 2.0.x+

For LCLscaling you must check the "Use LCL scaling" box in the project options, and on Windows you should switch "DPI awareness" to "on (true)" (if you have a second monitor you could also try the "Per Monitor" (PM) settings, but there were issues).

You should also make sure that "Force DPI scaling in designtime" is checked in the form editors options (right-click on form > Options).

With these settings I did a lot of experiments with loading and editing projects in Windows at several resolutions, and it always worked correctly.

I use Lazarus 2.1.0/fpc 3.2.0 on Windows and Linux built using fpcupdeluxe. Thanks for your suggestions. I'll try them and report my findings.

JD
Windows (10), Linux Mint - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

 

TinyPortal © 2005-2018