AutoSize does not size properly with TFlowPanel. lazarus / 31-LCL ---------------------------------------------------------------------- jamie · 2023-01-02 01:28 as its stated. Using AutoSize set to True, the child controls will hit the wall and even exceed the wall on one side. This also includes setting the border width, which it totally ignores the setting and still hits the wall overflowing at times.  Drop a TFlowpanel on the form, drop a Tbutton in it or something with its own complete border and set the property "AutoSize" = True.   Maybe someone with more time than I can look at it. This would be in the trunk on windows, btw if that makes any difference, could even be in the last release? ---------------------------------------------------------------------- dsiders · 2023-01-02 01:39 Quote from: jamie on January 02, 2023, 02:28:31 amas its stated. Using AutoSize set to True, the child controls will hit the wall and even exceed the wall on one side. This also includes setting the border width, which it totally ignores the setting and still hits the wall overflowing at times.  Drop a TFlowpanel on the form, drop a Tbutton in it or something with its own complete border and set the property "AutoSize" = True.   Maybe someone with more time than I can look at it. This would be in the trunk on windows, btw if that makes any difference, could even be in the last release? I wouldn't get my hopes up too high. How may times was it "dog fooded" in the IDE? The answer is: 0 times. [Edit] I stand corrected... it is used the packagetabs component. ---------------------------------------------------------------------- wp · 2023-01-02 11:04 Replace the "for" loop in TCustomFlowPanel.CalculatePreferredSize (file lcl/include/customflowpanel.inc) by the following code, and report back: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     for I := 0 to ControlCount-1 do    begin      xControl := FControlList.Items[I].Control;      if FFlowStyle in [fsLeftRightTopBottom, fsRightLeftTopBottom, fsLeftRightBottomTop, fsRightLeftBottomTop] then      begin        PreferredHeight := Max(PreferredHeight,          xControl.BoundsRect.Bottom+xControl.Bord erSpacing.Around+xControl.BorderSpacing.Bottom +          xTestRect.Bottom - xClientRect.Bottom);        PreferredWidth := Max(PreferredWidth,          xControl.Width + xControl.BorderSpacing.AroundLeft + xControl.BorderSpacing.AroundRight +          xTestRect.Right - xClientRect.Right - xTestRect.Left + xClientRect.Left        );      end else      begin        PreferredWidth := Max(PreferredWidth,          xControl.BoundsRect.Rig ht+xControl.BorderSpacing.Around+xControl.BorderSpacing.Right +        xTestRect.Right - xClientRect.Right);        PreferredHeight := Max(PreferredHeight,          xControl.Height + xControl.BorderSpacing.AroundTop + xControl.BorderSpacing.AroundBottom +          xTestRect.Bottom - xClientRect.Bottom - xTestRect.Top + xClientRect.Top        );      end; ---------------------------------------------------------------------- retenta · 2026-09-22 00:15 Replace the implementation of the TCustomFlowPanel.CalculatePreferredSize procedure with the code below. procedure TCustomFlowPanel.CalculatePreferredSize(var PreferredWidth,   PreferredHeight: integer; WithThemeSpace: Boolean); var   xControl: TControl;   xConBS: TControlBorderSpacing;   xClientRect: TRect;   xHoriz: Boolean;   xAvail, xStep: Integer;   xLineLength, xLineSize, xTotalSize: Integer;   I: Integer; begin   inherited CalculatePreferredSize(PreferredWidth, PreferredHeight,     WithThemeSpace);   if FControlList.Count = 0 then     Exit;   xHoriz := FFlowStyle in [fsLeftRightTopBottom, fsRightLeftTopBottom,                            fsLeftRightBottomTop, fsRightLeftBottomTop];   // largura/altura real disponível: define onde ocorre a quebra de linha   xClientRect := Rect(0, 0, ClientWidth, ClientHeight);   AdjustClientRect(xClientRect);   if xHoriz then     xAvail := xClientRect.Right   else     xAvail := xClientRect.Bottom;   xLineLength := 0; { comprimento acumulado da linha/coluna corrente }   xLineSize := 0;   { maior tamanho do eixo secundario na linha corrente }   xTotalSize := 0;  { soma das alturas (horiz) / larguras (vert) }   for I := 0 to FControlList.Count-1 do   begin     xControl := FControlList.Items.Control;     if xControl = nil then       Continue;     if not xControl.Visible and not (csDesigning in ComponentState) then       Continue;     xConBS := xControl.BorderSpacing;     if xHoriz then       xStep := xConBS.ControlWidth     else       xStep := xConBS.ControlHeight;     if FAutoWrap and (xLineLength > 0)     and (xLineLength + xStep > xAvail) then     begin       Inc(xTotalSize, xLineSize); // fecha a linha/coluna corrente       xLineLength := 0;       xLineSize := 0;     end;     Inc(xLineLength, xStep);     if xHoriz then     begin       if xConBS.ControlHeight > xLineSize then         xLineSize := xConBS.ControlHeight;       PreferredWidth := Max(PreferredWidth, xLineLength);     end else     begin       if xConBS.ControlWidth > xLineSize then         xLineSize := xConBS.ControlWidth;       PreferredHeight := Max(PreferredHeight, xLineLength);     end;   end;   Inc(xTotalSize, xLineSize); // ultima linha/coluna   if xHoriz then   begin     if xTotalSize > 0 then       PreferredHeight := xTotalSize + Width - ClientWidth;   end else   begin     if xTotalSize > 0 then       PreferredWidth := xTotalSize + Height - ClientHeight;   end; end; ---------------------------------------------------------------------- PascalDragon · 2026-09-24 19:22 Quote from: retenta on September 22, 2026, 02:15:28 amReplace the implementation of the TCustomFlowPanel.CalculatePreferredSize procedure with the code below. Please use [code=pascal][/code]-code tags to avoid your code being interpreted by the forum software.