[Lazarus] Hi-DPI tweak of components

Vojtěch Čihák vojtech.cihak at atlas.cz
Wed Jun 14 21:52:25 CEST 2023


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 subcomponent anchored to it).
When I put them on the form, DoAutoAdjustLayout() is triggered only in the first case.
Is it that Owner is responsible to call DoAutoAdjustLayout() of owned controls?
 
V.


______________________________________________________________
> Od: "Ondrej Pokorny via lazarus" <lazarus at lists.lazarus-ide.org>
> Komu: lazarus at lists.lazarus-ide.org
> Datum: 08.06.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 := Round(MySize * AXProportion);
Simple as that.
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().
Ondrej

 
 ----------
 
 -- 
 _______________________________________________
 lazarus mailing list
 lazarus at lists.lazarus-ide.org
 https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230614/6b857df5/attachment.htm>


More information about the lazarus mailing list