<p style="padding:0 0 0 0; margin:0 0 0 0;">Try to add there AnchorParallel:</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;">labSurface [0].AnchorSide [akTop].Control := labSurfaceLocation;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [0].AnchorSide [akTop].Side := asrBottom;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [0].AnchorSide [akLeft].Control := Parent;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [0].AnchorSide [akLeft].Side := asrRight;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface[0].AnchorParallel(akLeft, 0, <span style="font-size: 13.3333px;">labSurfaceLocation</span>);</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">for index := 1 to 8 do begin</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [index].AnchorSide [akTop].Control := labSurface [index - 1];</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [index].AnchorSide [akTop].Side := asrBottom;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [index].AnchorSide [akLeft].Control := Parent;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [index].AnchorSide [akLeft].Side := asrRight;</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">labSurface [index].AnchorParallel(akLeft, 0, <span style="font-size: 13.3333px;">labSurfaceLocation</span>);</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">end; </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: "Timothy Groves via lazarus" <lazarus@lists.lazarus-ide.org><br />
> Komu: "Lazarus mailing list" <lazarus@lists.lazarus.freepascal.org><br />
> Datum: 12.02.2021 19:26<br />
> Předmět: [Lazarus] Borderspacing property not working?<br />
></p>
<div dir="ltr">
<div>I have created several dynamic controls in my form, and setting the BorderSpacing property produces consistently incorrect results. Dynamically created controls will exhibit borders between themselves, but not to the parent object. What am I doing wrong?</div>
<div>Here is a chunk of the offending code.</div>
for index := 0 to 8 do begin<br />
labSurface [index] := tLabel.Create (Application);<br />
with (labSurface [index]) do begin<br />
parent := tabSurface;<br />
Caption := LocationNames [index];<br />
BorderSpacing.Around := 8;<br />
BorderSpacing.Left := 8;<br />
Anchors := [akTop, akLeft];<br />
end;<br />
end;<br />
<br />
labSurface [0].AnchorSide [akTop].Control := labSurfaceLocation;<br />
labSurface [0].AnchorSide [akTop].Side := asrBottom;<br />
labSurface [0].AnchorSide [akLeft].Control := Parent;<br />
labSurface [0].AnchorSide [akLeft].Side := asrRight;<br />
for index := 1 to 8 do begin<br />
labSurface [index].AnchorSide [akTop].Control := labSurface [index - 1];<br />
labSurface [index].AnchorSide [akTop].Side := asrBottom;<br />
labSurface [index].AnchorSide [akLeft].Control := Parent;<br />
labSurface [index].AnchorSide [akLeft].Side := asrRight;<br />
end;<br />
-- <br />
<div class="gmail_signature" dir="ltr">"Cows fly like clouds, but are never quite successful." <br />
--Megahal</div>
</div>
<br />
<br />
----------<br />
<br />
-- <br />
_______________________________________________<br />
lazarus mailing list<br />
lazarus@lists.lazarus-ide.org<br />
<a href="https://lists.lazarus-ide.org/listinfo/lazarus">https://lists.lazarus-ide.org/listinfo/lazarus</a><br />