Recent

Author Topic: AutoSize does not size properly with TFlowPanel.  (Read 777 times)

jamie

  • Hero Member
  • *****
  • Posts: 7610
AutoSize does not size properly with TFlowPanel.
« on: January 02, 2023, 02:28:31 am »
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?


The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1557
Re: AutoSize does not size properly with TFlowPanel.
« Reply #1 on: January 02, 2023, 02:39:14 am »
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?

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.
« Last Edit: January 02, 2023, 02:54:28 am by dsiders »

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: AutoSize does not size properly with TFlowPanel.
« Reply #2 on: January 02, 2023, 12:04:00 pm »
Replace the "for" loop in TCustomFlowPanel.CalculatePreferredSize (file lcl/include/customflowpanel.inc) by the following code, and report back:

Code: Pascal  [Select][+][-]
  1.     for I := 0 to ControlCount-1 do
  2.     begin
  3.       xControl := FControlList.Items[I].Control;
  4.       if FFlowStyle in [fsLeftRightTopBottom, fsRightLeftTopBottom, fsLeftRightBottomTop, fsRightLeftBottomTop] then
  5.       begin
  6.         PreferredHeight := Max(PreferredHeight,
  7.           xControl.BoundsRect.Bottom+xControl.BorderSpacing.Around+xControl.BorderSpacing.Bottom +
  8.           xTestRect.Bottom - xClientRect.Bottom);
  9.         PreferredWidth := Max(PreferredWidth,
  10.           xControl.Width + xControl.BorderSpacing.AroundLeft + xControl.BorderSpacing.AroundRight +
  11.           xTestRect.Right - xClientRect.Right - xTestRect.Left + xClientRect.Left
  12.         );
  13.       end else
  14.       begin
  15.         PreferredWidth := Max(PreferredWidth,
  16.           xControl.BoundsRect.Right+xControl.BorderSpacing.Around+xControl.BorderSpacing.Right +
  17.           xTestRect.Right - xClientRect.Right);
  18.         PreferredHeight := Max(PreferredHeight,
  19.           xControl.Height + xControl.BorderSpacing.AroundTop + xControl.BorderSpacing.AroundBottom +
  20.           xTestRect.Bottom - xClientRect.Bottom - xTestRect.Top + xClientRect.Top
  21.         );
  22.       end;
  23.  

 

TinyPortal © 2005-2018