mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 13:17:03 +02:00
LCL: DoAllAutoSize: check handleallocated for childs, needed after SetParent
git-svn-id: trunk@24407 -
This commit is contained in:
parent
20a40f4a3b
commit
7c4cb1efcb
@ -1008,7 +1008,7 @@ procedure TCustomForm.SetParent(NewParent: TWinControl);
|
|||||||
begin
|
begin
|
||||||
if Parent=NewParent then exit;
|
if Parent=NewParent then exit;
|
||||||
{$IFNDEF OldAutoSize}
|
{$IFNDEF OldAutoSize}
|
||||||
DisableAutoSizing;
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.SetParent'){$ENDIF};
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
try
|
try
|
||||||
if HandleAllocated then DestroyHandle;
|
if HandleAllocated then DestroyHandle;
|
||||||
@ -1017,7 +1017,7 @@ begin
|
|||||||
HandleNeeded;
|
HandleNeeded;
|
||||||
finally
|
finally
|
||||||
{$IFNDEF OldAutoSize}
|
{$IFNDEF OldAutoSize}
|
||||||
EnableAutoSizing;
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.SetParent'){$ENDIF};
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -107,12 +107,12 @@ procedure TToolBar.CreateWnd;
|
|||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
DisableAutoSizing;
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TToolBar.CreateWnd'){$ENDIF};
|
||||||
try
|
try
|
||||||
inherited CreateWnd;
|
inherited CreateWnd;
|
||||||
UpdateVisibleBar;
|
UpdateVisibleBar;
|
||||||
finally
|
finally
|
||||||
EnableAutoSizing;
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TToolBar.CreateWnd'){$ENDIF};
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
|
@ -3409,6 +3409,30 @@ end;
|
|||||||
{$IFNDEF OldAutoSize}
|
{$IFNDEF OldAutoSize}
|
||||||
procedure TWinControl.DoAllAutoSize;
|
procedure TWinControl.DoAllAutoSize;
|
||||||
|
|
||||||
|
function CheckHandleAllocated(AWinControl: TWinControl): boolean;
|
||||||
|
// true if a handle was missing
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
ChildWinControl: TWinControl;
|
||||||
|
begin
|
||||||
|
if AWinControl.HandleObjectShouldBeVisible
|
||||||
|
and (not AWinControl.HandleAllocated) then
|
||||||
|
begin
|
||||||
|
{$IFDEF VerboseAllAutoSize}
|
||||||
|
DebugLn(['TWinControl.DoAllAutoSize CREATE HANDLE ',DbgSName(AWinControl)]);
|
||||||
|
{$ENDIF}
|
||||||
|
AWinControl.HandleNeeded;
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
|
for i:=0 to AWinControl.ControlCount-1 do begin
|
||||||
|
ChildWinControl:=TWinControl(AWinControl.Controls[i]);
|
||||||
|
if (ChildWinControl is TWinControl)
|
||||||
|
and CheckHandleAllocated(ChildWinControl) then
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure ClearRequests(AControl: TControl);
|
procedure ClearRequests(AControl: TControl);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -3442,21 +3466,17 @@ begin
|
|||||||
DebugLn(['TWinControl.DoAllAutoSize START ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
DebugLn(['TWinControl.DoAllAutoSize START ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// create needed handles
|
// create needed handles
|
||||||
if not HandleAllocated then begin
|
if HandleObjectShouldBeVisible then begin
|
||||||
if HandleObjectShouldBeVisible then begin
|
if CheckHandleAllocated(Self) then begin
|
||||||
{$IFDEF VerboseAllAutoSize}
|
|
||||||
DebugLn(['TWinControl.DoAllAutoSize CREATE HANDLE ',DbgSName(Self)]);
|
|
||||||
{$ENDIF}
|
|
||||||
HandleNeeded;
|
|
||||||
// creating the handle called DisableAutoSizing/EnableAutoSizing
|
// creating the handle called DisableAutoSizing/EnableAutoSizing
|
||||||
// so after handle creation the autosizing was done
|
// so after handle creation the autosizing was done
|
||||||
// => exit
|
// => exit
|
||||||
exit;
|
exit;
|
||||||
end else begin
|
|
||||||
// no autosize possible => remove needed flags
|
|
||||||
ClearRequests(Self);
|
|
||||||
exit;
|
|
||||||
end;
|
end;
|
||||||
|
end else begin
|
||||||
|
// no autosize possible => remove needed flags
|
||||||
|
ClearRequests(Self);
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Include(FWinControlFlags,wcfAllAutoSizing);
|
Include(FWinControlFlags,wcfAllAutoSizing);
|
||||||
@ -6041,6 +6061,8 @@ begin
|
|||||||
AControl.UpdateAnchorRules;
|
AControl.UpdateAnchorRules;
|
||||||
AControl.RequestAlign;
|
AControl.RequestAlign;
|
||||||
end;
|
end;
|
||||||
|
{$ELSE}
|
||||||
|
AdjustSize;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Perform(CM_CONTROLCHANGE, WParam(AControl), LParam(True));
|
Perform(CM_CONTROLCHANGE, WParam(AControl), LParam(True));
|
||||||
{$IFNDEF OldAutoSize}
|
{$IFNDEF OldAutoSize}
|
||||||
|
Loading…
Reference in New Issue
Block a user