mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 21:30:35 +02:00
LCL: fix autosizing for not-aligned controls. Issue #28654
git-svn-id: trunk@56947 -
This commit is contained in:
parent
8726ea2759
commit
9ecac75432
@ -3025,28 +3025,27 @@ procedure TControl.DoAllAutoSize;
|
||||
var
|
||||
AWinControl: TWinControl;
|
||||
i: Integer;
|
||||
Needed: Boolean;
|
||||
begin
|
||||
if AControl.AutoSizeDelayed then exit;
|
||||
Needed:=cfAutoSizeNeeded in AControl.FControlFlags;
|
||||
|
||||
//DebugLn(['TControl.DoAllAutoSize.AutoSizeControl ',DbgSName(AControl),' AutoSize=',AControl.AutoSize,' IsControlVisible=',AControl.IsControlVisible,' cfAutoSizeNeeded=',Needed]);
|
||||
Exclude(AControl.FControlFlags, cfAutoSizeNeeded);
|
||||
if not AControl.IsControlVisible then exit;
|
||||
|
||||
if Needed and AControl.AutoSize and
|
||||
(not ((AControl.Parent = nil) and (csDesigning in AControl.ComponentState)))
|
||||
then
|
||||
AControl.DoAutoSize;
|
||||
if AControl is TWinControl then
|
||||
if AControl.IsControlVisible then
|
||||
begin
|
||||
// recursive
|
||||
AWinControl := TWinControl(AControl);
|
||||
//DebugLn(['AutoSizeControl ',DbgSName(AWinControl)]);
|
||||
AWinControl.AlignControl(nil);
|
||||
for i := 0 to AWinControl.ControlCount - 1 do
|
||||
AutoSizeControl(AWinControl.Controls[i]);
|
||||
if (cfAutoSizeNeeded in AControl.FControlFlags) and AControl.AutoSize and
|
||||
(not ((AControl.Parent = nil) and (csDesigning in AControl.ComponentState)))
|
||||
then
|
||||
AControl.DoAutoSize;
|
||||
if AControl is TWinControl then
|
||||
begin
|
||||
// recursive
|
||||
AWinControl := TWinControl(AControl);
|
||||
//DebugLn(['AutoSizeControl ',DbgSName(AWinControl)]);
|
||||
AWinControl.AlignControl(nil);
|
||||
for i := 0 to AWinControl.ControlCount - 1 do
|
||||
AutoSizeControl(AWinControl.Controls[i]);
|
||||
end;
|
||||
end;
|
||||
Exclude(AControl.FControlFlags, cfAutoSizeNeeded);
|
||||
end;
|
||||
|
||||
function CallAllOnResize(AControl: TControl): boolean;
|
||||
|
@ -2554,6 +2554,8 @@ var
|
||||
CurControl: TControl;
|
||||
begin
|
||||
Result := True;
|
||||
if cfAutoSizeNeeded in FControlFlags then
|
||||
Exit;
|
||||
for I := ControlCount - 1 downto 0 do
|
||||
begin
|
||||
CurControl:=Controls[I];
|
||||
|
Loading…
Reference in New Issue
Block a user