Discussion:
[Lazarus] LCL High-DPI
Ondrej Pokorny via Lazarus
2017-02-20 16:46:13 UTC
Permalink
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.

It's quite easy for the programmer. Documented here:
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI in
Lazarus 1.7 and above").

1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.

2.) To make your own application use the new LCL scaling and to make
sure your layouts don't get destroyed, do the following:

a.) Make sure you don't change the system DPI settings during the proccess.
b.) Update the IDE to the latest trunk and rebuild it.
c.) Open your project in the IDE.
d.) Enable LCL scaling for your application DPI awarness in Project
Options -> Application -> "Use LCL scaling (Hi-DPI).
e.) On Windows: enable DPI awarness in Project Options -> Application.
Decide if you want to support per monitor DPI awarness or not.
f.) Make sure TForm.Scaled=True for all your forms (default value).
g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale
coordinates during the run-time.

And you are ready. Your forms will scale both in runtime and design time
nicely.

For those who followed my last announcement: as Zeljko and Michael
requested, I removed the LCLScaleForms define and introduced the
Application.Scaled property instead (that you set in step 2d). The
default value is Application.Scaled=False.

If you keep Application.Scaled=False, there won't be any changes in your
application.

Please report issues or comment on problems. I have still time to change
things until Lazarus 1.8 is out (you can expect RC1 in April).

Ondrej

--
Maciej Izak via Lazarus
2017-02-21 09:21:14 UTC
Permalink
2017-02-20 17:46 GMT+01:00 Ondrej Pokorny via Lazarus <
I'd like to announce that I finished the concept of DPI scaling in Lazarus
/ LCL.
Thanks to your work Lazarus is now much, much better than Delphi in this
field ^^.
--
Best regards,
Maciej Izak
Alexey via Lazarus
2017-02-21 13:44:11 UTC
Permalink
Post by Maciej Izak via Lazarus
Thanks to your work Lazarus is now much, much better than Delphi in
this field ^^.
Yes, thanks to Ondrej, very good work
--
Regards,
Alexey

--
Donald Ziesig via Lazarus
2017-02-21 15:40:02 UTC
Permalink
Hi Ondrej!

Your work has made a major improvement in Lazarus. It is much more
enjoyable to use. I have converted my most recent major APP using it
and it was mostly straight forward.

I will continue using it and report back to you as my work permits.

Thank you,

Don Ziesig
Post by Ondrej Pokorny via Lazarus
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI
in Lazarus 1.7 and above").
1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.
2.) To make your own application use the new LCL scaling and to make
a.) Make sure you don't change the system DPI settings during the proccess.
b.) Update the IDE to the latest trunk and rebuild it.
c.) Open your project in the IDE.
d.) Enable LCL scaling for your application DPI awarness in Project
Options -> Application -> "Use LCL scaling (Hi-DPI).
e.) On Windows: enable DPI awarness in Project Options -> Application.
Decide if you want to support per monitor DPI awarness or not.
f.) Make sure TForm.Scaled=True for all your forms (default value).
g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale
coordinates during the run-time.
And you are ready. Your forms will scale both in runtime and design
time nicely.
For those who followed my last announcement: as Zeljko and Michael
requested, I removed the LCLScaleForms define and introduced the
Application.Scaled property instead (that you set in step 2d). The
default value is Application.Scaled=False.
If you keep Application.Scaled=False, there won't be any changes in
your application.
Please report issues or comment on problems. I have still time to
change things until Lazarus 1.8 is out (you can expect RC1 in April).
Ondrej
--
Donald Ziesig via Lazarus
2017-02-21 18:13:31 UTC
Permalink
One more question. Where can I find documentation for
TControl.ScaleCoord() or ScaleCoord96()? It is not in the CCR. I will
search the source.

Don
Post by Ondrej Pokorny via Lazarus
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI
in Lazarus 1.7 and above").
1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.
2.) To make your own application use the new LCL scaling and to make
a.) Make sure you don't change the system DPI settings during the proccess.
b.) Update the IDE to the latest trunk and rebuild it.
c.) Open your project in the IDE.
d.) Enable LCL scaling for your application DPI awarness in Project
Options -> Application -> "Use LCL scaling (Hi-DPI).
e.) On Windows: enable DPI awarness in Project Options -> Application.
Decide if you want to support per monitor DPI awarness or not.
f.) Make sure TForm.Scaled=True for all your forms (default value).
g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale
coordinates during the run-time.
And you are ready. Your forms will scale both in runtime and design
time nicely.
For those who followed my last announcement: as Zeljko and Michael
requested, I removed the LCLScaleForms define and introduced the
Application.Scaled property instead (that you set in step 2d). The
default value is Application.Scaled=False.
If you keep Application.Scaled=False, there won't be any changes in
your application.
Please report issues or comment on problems. I have still time to
change things until Lazarus 1.8 is out (you can expect RC1 in April).
Ondrej
--
Ondrej Pokorny via Lazarus
2017-02-21 18:51:45 UTC
Permalink
Post by Donald Ziesig via Lazarus
One more question. Where can I find documentation for
TControl.ScaleCoord() or ScaleCoord96()? It is not in the CCR. I
will search the source.
The difference is in the scale basis:
ScaleCoord96: hard-coded 96.
ScaleCoord: DesignTimePPI (= the PPI of the IDE - be aware that it can
change if you open your project on a different system with different DPI).

ScaleCoord96 is to use for hard-coded values in 96 PPI.

I'll document the functions in the CCR.

Ondrej
--
Donald Ziesig via Lazarus
2017-02-21 18:03:06 UTC
Permalink
Hi Ondrej!

I just ran into two issues with the IDE in High-DPI mode.

The IDE main window changed from yesterday (when I first used it) to
today. Yesterday all of the Buttons were larger (but the internal
images were still small). Today the Buttons have returned to their
small sizes. The internal images are still small).



I don't know what caused the change.

The "Watch Properties" window is erroneously scaled for the font.




Thanks,

Don Ziesig
Post by Ondrej Pokorny via Lazarus
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI
in Lazarus 1.7 and above").
1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.
2.) To make your own application use the new LCL scaling and to make
a.) Make sure you don't change the system DPI settings during the proccess.
b.) Update the IDE to the latest trunk and rebuild it.
c.) Open your project in the IDE.
d.) Enable LCL scaling for your application DPI awarness in Project
Options -> Application -> "Use LCL scaling (Hi-DPI).
e.) On Windows: enable DPI awarness in Project Options -> Application.
Decide if you want to support per monitor DPI awarness or not.
f.) Make sure TForm.Scaled=True for all your forms (default value).
g.) Make sure you use TControl.ScaleCoord() or ScaleCoord96() to scale
coordinates during the run-time.
And you are ready. Your forms will scale both in runtime and design
time nicely.
For those who followed my last announcement: as Zeljko and Michael
requested, I removed the LCLScaleForms define and introduced the
Application.Scaled property instead (that you set in step 2d). The
default value is Application.Scaled=False.
If you keep Application.Scaled=False, there won't be any changes in
your application.
Please report issues or comment on problems. I have still time to
change things until Lazarus 1.8 is out (you can expect RC1 in April).
Ondrej
Ondrej Pokorny via Lazarus
2017-02-21 21:13:43 UTC
Permalink
Strange, it looks good here (the latest revision):
Loading Image...

I've been working on High DPI today so maybe it was broken at some point
during the day (?)

Ondrej
Post by Donald Ziesig via Lazarus
Hi Ondrej!
I just ran into two issues with the IDE in High-DPI mode.
The IDE main window changed from yesterday (when I first used it) to
today. Yesterday all of the Buttons were larger (but the internal
images were still small). Today the Buttons have returned to their
small sizes. The internal images are still small).
I don't know what caused the change.
The "Watch Properties" window is erroneously scaled for the font.
Thanks,
Don Ziesig
--
Donald Ziesig via Lazarus
2017-02-21 21:38:35 UTC
Permalink
Very strange. I looked at all of the Form DesignTimePPI and they were
set to 96! I shut down Lazarus and re-started it and they all changed
back to 144 (and the little buttons got big!). My forms all look good
again except for the "Watch Properties".

I'll keep trying and let you know.

Don
Post by Ondrej Pokorny via Lazarus
https://s17.postimg.org/9a9oa9cyn/Linux_120_DPI.png
I've been working on High DPI today so maybe it was broken at some
point during the day (?)
Ondrej
Post by Donald Ziesig via Lazarus
Hi Ondrej!
I just ran into two issues with the IDE in High-DPI mode.
The IDE main window changed from yesterday (when I first used it) to
today. Yesterday all of the Buttons were larger (but the internal
images were still small). Today the Buttons have returned to their
small sizes. The internal images are still small).
I don't know what caused the change.
The "Watch Properties" window is erroneously scaled for the font.
Thanks,
Don Ziesig
--
Michael Van Canneyt via Lazarus
2017-02-22 22:18:41 UTC
Permalink
Post by Ondrej Pokorny via Lazarus
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI in
Lazarus 1.7 and above").
1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.
I have tried this. I see no effect whatsoever ?

I have even specially opened 2 IDEs. One which is more than a year old, and
the newly compiled one. They look identical.

I checked, and I found
Application.Scaled := True;
in the sources.

I checked dpi, xrdb reports DPI 192.

Linux Mint 18.1, 64-bit, GTK 2 widgetset.

Any hints ?

Michael.
--
Ondrej Pokorny via Lazarus
2017-02-24 10:12:15 UTC
Permalink
Post by Michael Van Canneyt via Lazarus
I have tried this. I see no effect whatsoever ?
I have even specially opened 2 IDEs. One which is more than a year old, and
the newly compiled one. They look identical.
I checked, and I found
Application.Scaled := True;
in the sources.
I checked dpi, xrdb reports DPI 192.
Linux Mint 18.1, 64-bit, GTK 2 widgetset.
Any hints ?
Create an empty LCL application and check the TForm.DesignTimePPI
property. What value does it show?

Ondrej
--
Ondrej Pokorny via Lazarus
2017-02-24 11:05:57 UTC
Permalink
Post by Michael Van Canneyt via Lazarus
Post by Ondrej Pokorny via Lazarus
I'd like to announce that I finished the concept of DPI scaling in
Lazarus / LCL.
http://wiki.lazarus.freepascal.org/High_DPI (details are in "High DPI
in Lazarus 1.7 and above").
1.) I made the Lazarus IDE High-DPI aware - the IDE itself and its
windows should scale correctly.
I have tried this. I see no effect whatsoever ?
I have even specially opened 2 IDEs. One which is more than a year old, and
the newly compiled one. They look identical.
I checked, and I found
Application.Scaled := True;
in the sources.
I checked dpi, xrdb reports DPI 192.
Create an empty LCL application and check the TForm.DesignTimePPI
property. What value does it show?

Ondrej
--

Loading...