Commit 9ecac754 authored by ondrej's avatar ondrej
Browse files

LCL: fix autosizing for not-aligned controls. Issue #28654

git-svn-id: trunk@56947 -
parent 8726ea27
......@@ -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];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment