mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 03:42:01 +02:00
LCL: fixed missing autosize, when design values are correct, widgetset returns false values during init and later sends a WMSize with the design values
git-svn-id: trunk@48575 -
This commit is contained in:
parent
49e3b7c5b1
commit
b92a5feb37
@ -2605,6 +2605,9 @@ procedure TCustomForm.Loaded;
|
|||||||
var
|
var
|
||||||
Control: TWinControl;
|
Control: TWinControl;
|
||||||
begin
|
begin
|
||||||
|
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
|
||||||
|
debugln(['[TCustomForm.Loaded] START ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]);
|
||||||
|
{$ENDIF}
|
||||||
DisableAlign;
|
DisableAlign;
|
||||||
try
|
try
|
||||||
inherited Loaded;
|
inherited Loaded;
|
||||||
@ -2661,7 +2664,7 @@ procedure TCustomForm.UpdateShowing;
|
|||||||
begin
|
begin
|
||||||
if csLoading in ComponentState then exit;
|
if csLoading in ComponentState then exit;
|
||||||
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
|
{$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)}
|
||||||
DebugLn(['[TCustomForm.UpdateShowing] STAR ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]);
|
DebugLn(['[TCustomForm.UpdateShowing] START ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// If the the form is about to show, calculate its metrics
|
// If the the form is about to show, calculate its metrics
|
||||||
if Visible and (not (csDestroying in ComponentState)) then
|
if Visible and (not (csDestroying in ComponentState)) then
|
||||||
|
@ -30,8 +30,8 @@ const CheckClientRectName = 'LCLInterfaceRadioGroup';
|
|||||||
{off $DEFINE VerboseSizeMsg}
|
{off $DEFINE VerboseSizeMsg}
|
||||||
{off $DEFINE CHECK_POSITION}
|
{off $DEFINE CHECK_POSITION}
|
||||||
{$IFDEF CHECK_POSITION}
|
{$IFDEF CHECK_POSITION}
|
||||||
const CheckPostionClassName = 'TBreakPropertyDlg';
|
const CheckPostionClassName = 'xxxTBreakPropertyDlg';
|
||||||
const CheckPostionName = 'xxxTBreakPropertyDlg';
|
const CheckPostionName = 'FakeStatusBar';
|
||||||
const CheckPostionParentName = 'xxxEnvVarsPage';
|
const CheckPostionParentName = 'xxxEnvVarsPage';
|
||||||
|
|
||||||
function CheckPosition(AControl: TControl): boolean;
|
function CheckPosition(AControl: TControl): boolean;
|
||||||
@ -3651,7 +3651,8 @@ begin
|
|||||||
InvalidateClientRectCache(False);
|
InvalidateClientRectCache(False);
|
||||||
R := GetClientRect;
|
R := GetClientRect;
|
||||||
AdjustClientRect(R);
|
AdjustClientRect(R);
|
||||||
//DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' ',r.Right,',',r.Bottom,' ',CompareRect(@r,@FAdjustClientRectRealized)]);
|
//if CheckPosition(Self) then
|
||||||
|
//DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' new=',dbgs(r),' old=',dbgs(FAdjustClientRectRealized),' ',CompareRect(@r,@FAdjustClientRectRealized)]);
|
||||||
if not CompareRect(@R, @FAdjustClientRectRealized) then
|
if not CompareRect(@R, @FAdjustClientRectRealized) then
|
||||||
begin
|
begin
|
||||||
// client rect changed since last AlignControl
|
// client rect changed since last AlignControl
|
||||||
@ -6299,6 +6300,11 @@ begin
|
|||||||
|
|
||||||
DisableAlign;
|
DisableAlign;
|
||||||
try
|
try
|
||||||
|
// store
|
||||||
|
ARect := GetClientRect;
|
||||||
|
AdjustClientRect(ARect);
|
||||||
|
FAdjustClientRectRealized:=ARect;
|
||||||
|
|
||||||
ARect:=GetLogicalClientRect;
|
ARect:=GetLogicalClientRect;
|
||||||
AlignControls(AControl, ARect);
|
AlignControls(AControl, ARect);
|
||||||
// some widgetsets updates their clientrect when the first child was moved
|
// some widgetsets updates their clientrect when the first child was moved
|
||||||
@ -6793,7 +6799,7 @@ begin
|
|||||||
// size algorithm to take care of the new bounds
|
// size algorithm to take care of the new bounds
|
||||||
// => do not call SetBounds, as this will set the Bounds to the widgetset
|
// => do not call SetBounds, as this will set the Bounds to the widgetset
|
||||||
// default values.
|
// default values.
|
||||||
//DebugLn(['TWinControl.WMSize from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
//DebugLn(['TWinControl.WMMove from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6869,7 +6875,8 @@ begin
|
|||||||
NewTop := FBoundsRealized.Top;
|
NewTop := FBoundsRealized.Top;
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
GetWindowRelativePosition(Handle, NewLeft, NewTop);
|
GetWindowRelativePosition(Handle, NewLeft, NewTop);
|
||||||
//DebugLn('TWinControl.WMSize B ',Name,':',ClassName,' ',NewLeft,',',NewTop);
|
//if CheckPosition(Self) then
|
||||||
|
//DebugLn(['TWinControl.WMSize GetWindowRelativePosition: ',DbgSName(Self),' ',NewLeft,',',NewTop,' ClientRectNeedsInterfaceUpdate=',ClientRectNeedsInterfaceUpdate]);
|
||||||
NewBoundsRealized := Bounds(NewLeft, NewTop, Message.Width, Message.Height);
|
NewBoundsRealized := Bounds(NewLeft, NewTop, Message.Width, Message.Height);
|
||||||
OldClientSize := Size(0, 0);
|
OldClientSize := Size(0, 0);
|
||||||
NewClientSize := Size(0, 0);
|
NewClientSize := Size(0, 0);
|
||||||
@ -6885,9 +6892,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF VerboseAllAutoSize}
|
{$IFDEF VerboseAllAutoSize}
|
||||||
|
{$IFDEF CHECK_POSITION}
|
||||||
|
if CheckPosition(Self) then
|
||||||
|
{$ENDIF}
|
||||||
DebugLn(['TWinControl.WMSize Changed From Intf ',dbgsname(Self),' Message=',Message.Width,',',Message.Height,
|
DebugLn(['TWinControl.WMSize Changed From Intf ',dbgsname(Self),' Message=',Message.Width,',',Message.Height,
|
||||||
' BoundsRealized=',dbgs(FBoundsRealized),
|
' BoundsRealized=',dbgs(FBoundsRealized),
|
||||||
' wcfClientRectNeedsUpdate=',wcfClientRectNeedsUpdate in FWinControlFlags]);
|
' wcfClientRectNeedsUpdate=',wcfClientRectNeedsUpdate in FWinControlFlags,
|
||||||
|
' ClientRectNeedsInterfaceUpdate=',ClientRectNeedsInterfaceUpdate]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
TopParent := GetTopParent;
|
TopParent := GetTopParent;
|
||||||
@ -6905,7 +6916,10 @@ begin
|
|||||||
// size algorithm to take care of the new bounds
|
// size algorithm to take care of the new bounds
|
||||||
// => do not call SetBounds, as this will set the Bounds to the widgetset
|
// => do not call SetBounds, as this will set the Bounds to the widgetset
|
||||||
// default values.
|
// default values.
|
||||||
//DebugLn(['TWinControl.WMSize from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
{$IFDEF CHECK_POSITION}
|
||||||
|
if CheckPosition(Self) then
|
||||||
|
{$ENDIF}
|
||||||
|
// DebugLn(['TWinControl.WMSize from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6917,10 +6931,14 @@ begin
|
|||||||
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height)
|
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height)
|
||||||
else
|
else
|
||||||
SetBounds(NewLeft, NewTop, Message.Width, Message.Height);
|
SetBounds(NewLeft, NewTop, Message.Width, Message.Height);
|
||||||
|
//if CheckPosition(Self) then
|
||||||
|
//debugln(['TWinControl.WMSize ',DbgSName(Self),' ClientRectNeedsInterfaceUpdate=',ClientRectNeedsInterfaceUpdate]);
|
||||||
if ((Message.SizeType and Size_SourceIsInterface) > 0) and ClientRectNeedsInterfaceUpdate then
|
if ((Message.SizeType and Size_SourceIsInterface) > 0) and ClientRectNeedsInterfaceUpdate then
|
||||||
DoAdjustClientRectChange;
|
DoAdjustClientRectChange;
|
||||||
{$IFDEF VerboseClientRectBugFix}
|
{$IFDEF VerboseClientRectBugFix}
|
||||||
//if Name=CheckClientRectName then
|
{$IFDEF CHECK_POSITION}
|
||||||
|
if CheckPosition(Self) then
|
||||||
|
{$ENDIF}
|
||||||
if ((Message.SizeType and Size_SourceIsInterface) > 0) then
|
if ((Message.SizeType and Size_SourceIsInterface) > 0) then
|
||||||
DebugLn(['TWinControl.WMSize END ',dbgsname(Self),' Message=',Message.Width,',',Message.Height,
|
DebugLn(['TWinControl.WMSize END ',dbgsname(Self),' Message=',Message.Width,',',Message.Height,
|
||||||
' BoundsRealized=',dbgs(FBoundsRealized),' ClientRect=',dbgs(ClientRect),
|
' BoundsRealized=',dbgs(FBoundsRealized),' ClientRect=',dbgs(ClientRect),
|
||||||
|
Loading…
Reference in New Issue
Block a user