<p style="padding:0 0 0 0; margin:0 0 0 0;">TLabeledEdit is probably not a good example since both TEdit and TLabel are native widgets (maybe they scale by widgetset) and there is some Spacing between them hardcoded to 3px. I cannot see any scaling related code in this simple component.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Anyway, I know what's going on:</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">procedure TWinControl.AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> const AFromPPI, AToPPI, AOldFormWidth, ANewFormWidth: Integer);</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">var</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> i: Integer;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">begin</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.AutoAdjustLayout'){$ENDIF};</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> try</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> for i:=0 to ControlCount-1 do</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> Controls[i].AutoAdjustLayout(AMode, AFromPPI, AToPPI, AOldFormWidth, ANewFormWidth);</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"><br />
</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> inherited;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> finally</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.AutoAdjustLayout'){$ENDIF};</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;"> end;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">end;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">i.e. form loops all its children and scale them. But when component is dropped on the form, scaling is done before Parent is set. Therefore only main component's DoAutoAdjustLayout is called, subcomponent is ommited.</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><span style="font-size: 13.3333px;">I noticed that it is opposite when loading from *.lfm. There scaling done after the Parent is set, so both component's and subcomponent's </span><span style="font-size: 10pt;">DoAutoAdjustLayout is called.</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">It's fine since there are simplier ways how to do initial scaling (when component is created and put on the form).</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Thanks, I only needed to understand better how it works.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br />
> Od: "Ondrej Pokorny" <lazarus@kluug.net><br />
> Komu: "Lazarus mailing list" <lazarus@lists.lazarus-ide.org><br />
> Datum: 15.06.2023 08:35<br />
> Předmět: Re: [Lazarus] Hi-DPI tweak of components<br />
></p>
<div class="moz-cite-prefix">On 14.06.2023 21:52, Vojtěch Čihák via lazarus wrote:</div>
<p style="padding:0 0 0 0; margin:0 0 0 0;">This is strange. All controls should be adjusted regardless of the Owner. TLabeledEdit works fine (edit that has an attached label).</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Ondrej</p>