Re: [Lazarus] Hi-DPI tweak of components

2023-06-17 Thread Vojtěch Čihák via lazarus
drej Pokorny" Komu: "Lazarus mailing list" Datum: 15.06.2023 08:35 Předmět: Re: [Lazarus] Hi-DPI tweak of components On 14.06.2023 21:52, Vojtěch Čihák via lazarus wrote:This is strange. All controls should be adjusted regardless of the Owner. T

Re: [Lazarus] Hi-DPI tweak of components

2023-06-14 Thread Ondrej Pokorny via lazarus
On 14.06.2023 21:52, Vojtěch Čihák via lazarus wrote: Hi, I have one more question to DoAutoAdjustLayout();. I use TECSpinBtns (TGraphicControl) in two variants: The first as a stand-alone component and the second as a part of TECSpinEdit (where TEdit is Owner and TECSpinBtns is subcomponen

Re: [Lazarus] Hi-DPI tweak of components

2023-06-14 Thread Vojtěch Čihák via lazarus
2023 08:08 Předmět: Re: [Lazarus] Hi-DPI tweak of components ---If you have values that need to be scaled you do: 1.) Initialize the sizes for Screen.PixelsPerInch in constructor: MySize := Scale96ToScreen(cMyValueAt96DPI); 2.) Use DoAutoAdjustLayout() to scale them when PPI changes: MySize := Ro

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
On 08.06.2023 19:30, Giuliano Colla wrote: Il 08/06/23 18:40, Ondrej Pokorny via lazarus ha scritto: And because it is so much fun, I wrote a completely general program to test it. Well you've shown that it isn't so bad. But there's another detail to consider, when resizing: font size. Font

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Giuliano Colla via lazarus
Il 08/06/23 18:40, Ondrej Pokorny via lazarus ha scritto: And because it is so much fun, I wrote a completely general program to test it. Well you've shown that it isn't so bad. But there's another detail to consider, when resizing: font size. Font size can (and should be) specified in typo

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
And because it is so much fun, I wrote a completely general program to test it. You can define how many resolution combinations you want to go through and what maximum value you want to start with and it goes through all possible combinations and gives you results after how many cycles a star

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
Here is a more general proof for every possible combination of resolutions between 100% and 400% and for values [0..1]: program Project1; uses Math; const   Resolutions: array[0..8] of Double = (1.00, 1.25, 1.50, 1.75, 2.00, 2.50, 3.00, 3.50, 4.00); var   SourceResultion, TargetResolution:

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
On 08.06.2023 12:24, Giuliano Colla wrote: Il 08/06/23 11:58, Ondrej Pokorny via lazarus ha scritto: All in all, an over-complicated approach with little gain. The gain would be that you do not add up rounding errors. We can't have fractional pixels, of course, but we may have the exact actu

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
On 08.06.2023 12:24, Giuliano Colla wrote: Il 08/06/23 11:58, Ondrej Pokorny via lazarus ha scritto: All in all, an over-complicated approach with little gain. The gain would be that you do not add up rounding errors. We can't have fractional pixels, of course, but we may have the exact actu

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Giuliano Colla via lazarus
Il 08/06/23 12:39, Jean SUZINEAU via lazarus ha scritto: I think you can't use integer value for mm or inches. Of course you can't. But you can use integer values for hundredth of mm (that's the resolution of high quality photo-composition) or for thousandth of inch (slightly worse but still

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Jean SUZINEAU via lazarus
Le 08/06/2023 à 11:34, Giuliano Colla via lazarus a écrit : I believe that scaling for different DPI has been implemented with a shortsighted approach. It would have been nice at the time of Delphi 1 in 1995 ... ;-) A few weeks ago I got some havoc trying to port some code from LCL to Delphi

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Giuliano Colla via lazarus
Il 08/06/23 11:58, Ondrej Pokorny via lazarus ha scritto: All in all, an over-complicated approach with little gain. The gain would be that you do not add up rounding errors. We can't have fractional pixels, of course, but we may have the exact actual size at design/creation time, and for e

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
On 08.06.2023 11:46, Giuliano Colla via lazarus wrote: Il 08/06/2023 11:34, Giuliano Colla via lazarus ha scritto: Il 08/06/2023 08:08, Ondrej Pokorny via lazarus ha scritto: Check TCustomColorBox how it handles FColorRectWidth as an example (it uses a default value and if the user overwrites

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Ondrej Pokorny via lazarus
On 08.06.2023 11:34, Giuliano Colla wrote: Il 08/06/2023 08:08, Ondrej Pokorny via lazarus ha scritto: Check TCustomColorBox how it handles FColorRectWidth as an example (it uses a default value and if the user overwrites it, it gets scaled in DoAutoAdjustLayout(). I believe that scaling for

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Giuliano Colla via lazarus
Il 08/06/2023 11:34, Giuliano Colla via lazarus ha scritto: Il 08/06/2023 08:08, Ondrej Pokorny via lazarus ha scritto: Check TCustomColorBox how it handles FColorRectWidth as an example (it uses a default value and if the user overwrites it, it gets scaled in DoAutoAdjustLayout(). I believ

Re: [Lazarus] Hi-DPI tweak of components

2023-06-08 Thread Giuliano Colla via lazarus
Il 08/06/2023 08:08, Ondrej Pokorny via lazarus ha scritto: Check TCustomColorBox how it handles FColorRectWidth as an example (it uses a default value and if the user overwrites it, it gets scaled in DoAutoAdjustLayout(). I believe that scaling for different DPI has been implemented with a

Re: [Lazarus] Hi-DPI tweak of components

2023-06-07 Thread Ondrej Pokorny via lazarus
On 08.06.2023 07:53, Ondrej Pokorny via lazarus wrote: On 08.06.2023 00:46, Vojtěch Čihák via lazarus wrote: Because I need to scale internals of TGraphicControl (which has no own Canvas or Handle) I decided to do scaling in SetParent();. You definitely should use DoAutoAdjustLayout(). Usu

Re: [Lazarus] Hi-DPI tweak of components

2023-06-07 Thread Ondrej Pokorny via lazarus
On 08.06.2023 00:46, Vojtěch Čihák via lazarus wrote: Thanks, please confirm me if I understand well the concept: 1) when component is put on the form in designer: it is scaled (Width & Height) Yes. 2) when it is put on the form later in code: it is not scaled It depends on what you un

Re: [Lazarus] Hi-DPI tweak of components

2023-06-07 Thread Vojtěch Čihák via lazarus
ředmět: Re: [Lazarus] Hi-DPI tweak of components On 07.06.2023 00:35, Vojtěch Čihák via lazarus wrote:... Here is information: https://wiki.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above <https://wiki.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above> IIRC, DoAutoAdjust

Re: [Lazarus] Hi-DPI tweak of components

2023-06-06 Thread Ondrej Pokorny via lazarus
On 07.06.2023 00:35, Vojtěch Čihák via lazarus wrote: I finally built a hi-DPI machine (28'' 4k display, currently set to 118PPI) and I need to tweak EC-Controls (https://wiki.freepascal.org/Eye-Candy_Controls) to scale better. One problematic is TECSpinBtns because it is designed like this:

[Lazarus] Hi-DPI tweak of components

2023-06-06 Thread Vojtěch Čihák via lazarus
Hi,   I finally built a hi-DPI machine (28'' 4k display, currently set to 118PPI) and I need to tweak EC-Controls (https://wiki.freepascal.org/Eye-Candy_Controls) to scale better. One problematic is TECSpinBtns because it is designed like this: it consists of (initially) nine small buttons (TPe