mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 21:38:00 +02:00
LCL: OnResize and OnChangeBounds are now suspended after OnCreate
git-svn-id: trunk@10360 -
This commit is contained in:
parent
2d42b48ed2
commit
3f4887140f
@ -561,9 +561,9 @@ type
|
||||
|
||||
TPersistentPropertyEditor = class(TPropertyEditor)
|
||||
protected
|
||||
function FilterFunc(const ATestEditor: TPropertyEditor{IProperty}): Boolean;
|
||||
function FilterFunc(const ATestEditor: TPropertyEditor): Boolean;
|
||||
function GetPersistentReference: TPersistent; virtual;
|
||||
function GetSelections: TPersistentSelectionList{IDesignerSelections}; virtual;
|
||||
function GetSelections: TPersistentSelectionList; virtual;
|
||||
public
|
||||
function AllEqual: Boolean; override;
|
||||
procedure Edit; override;
|
||||
|
@ -739,7 +739,9 @@ type
|
||||
cfClientHeightLoaded,
|
||||
cfLastAlignedBoundsValid,
|
||||
cfBoundsRectForNewParentValid,
|
||||
cfPreferredSizeValid
|
||||
cfPreferredSizeValid,
|
||||
cfOnResizeNeeded,
|
||||
cfOnChangeBoundsNeeded
|
||||
);
|
||||
TControlFlags = set of TControlFlag;
|
||||
|
||||
@ -1025,6 +1027,7 @@ type
|
||||
procedure Loaded; override;
|
||||
procedure DefineProperties(Filer: TFiler); override;
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
procedure FormEndUpdated; virtual;
|
||||
procedure InvalidateControl(CtrlIsVisible, CtrlIsOpaque: Boolean);
|
||||
procedure InvalidateControl(CtrlIsVisible, CtrlIsOpaque, IgnoreWinControls: Boolean);
|
||||
procedure FontChanged(Sender: TObject); virtual;
|
||||
@ -1164,6 +1167,7 @@ type
|
||||
function GetTopParent: TControl;
|
||||
function IsVisible: Boolean; virtual;
|
||||
function IsControlVisible: Boolean; virtual;
|
||||
function FormIsUpdating: boolean; virtual;
|
||||
procedure Hide;
|
||||
procedure Refresh;
|
||||
procedure Repaint; virtual;
|
||||
@ -1636,6 +1640,7 @@ type
|
||||
procedure FontChanged(Sender: TObject); override;
|
||||
procedure InitializeWnd; virtual; // gets called after the Handle is created and before the child handles are created
|
||||
procedure Loaded; override;
|
||||
procedure FormEndUpdated; override;
|
||||
procedure MainWndProc(var Msg: TLMessage);
|
||||
procedure ParentFormHandleInitialized; override;
|
||||
procedure ChildHandlesCreated; virtual;// called after childs handles are created
|
||||
|
@ -423,7 +423,6 @@ type
|
||||
protected
|
||||
FFormBorderStyle: TFormBorderStyle;
|
||||
FActionLists: TList;
|
||||
function FormUpdating: boolean;
|
||||
procedure Activate; dynamic;
|
||||
procedure ActiveChanged; dynamic;
|
||||
procedure BeginFormUpdate;
|
||||
@ -448,6 +447,7 @@ type
|
||||
procedure UpdateWindowState;
|
||||
procedure VisibleChanging; override;
|
||||
procedure WndProc(var TheMessage : TLMessage); override;
|
||||
function FormIsUpdating: boolean; override;
|
||||
function VisibleIsStored: boolean;
|
||||
function ColorIsStored: boolean; override;
|
||||
procedure DoSendBoundsToInterface; override;
|
||||
|
@ -656,6 +656,11 @@ begin
|
||||
and (not (csNoDesignVisible in ControlStyle))));
|
||||
end;
|
||||
|
||||
function TControl.FormIsUpdating: boolean;
|
||||
begin
|
||||
Result:=(Parent<>nil) and Parent.FormIsUpdating;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl.LMCaptureChanged
|
||||
------------------------------------------------------------------------------}
|
||||
@ -823,6 +828,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.DoOnResize;
|
||||
begin
|
||||
Exclude(FControlFlags,cfOnResizeNeeded);
|
||||
if Assigned(FOnResize) then FOnResize(Self);
|
||||
DoCallNotifyHandler(chtOnResize);
|
||||
end;
|
||||
@ -834,6 +840,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.DoOnChangeBounds;
|
||||
begin
|
||||
Exclude(FControlFlags,cfOnChangeBoundsNeeded);
|
||||
if Assigned(FOnChangeBounds) then FOnChangeBounds(Self);
|
||||
DoCallNotifyHandler(chtOnChangeBounds);
|
||||
end;
|
||||
@ -848,6 +855,10 @@ begin
|
||||
CurClientSize:=Point(ClientWidth,ClientHeight);
|
||||
if (not CompareRect(@FLastDoChangeBounds,@CurBounds))
|
||||
or (ComparePoints(CurClientSize,FLastDoChangeClientSize)<>0) then begin
|
||||
if FormIsUpdating then begin
|
||||
Include(FControlFlags,cfOnChangeBoundsNeeded);
|
||||
exit;
|
||||
end;
|
||||
FLastDoChangeBounds:=CurBounds;
|
||||
FLastDoChangeClientSize:=CurClientSize;
|
||||
DoOnChangeBounds;
|
||||
@ -2515,15 +2526,20 @@ end;
|
||||
procedure TControl.Resize;
|
||||
begin
|
||||
if ([csLoading,csDestroying]*ComponentState<>[]) then exit;
|
||||
|
||||
if (FLastResizeWidth<>Width) or (FLastResizeHeight<>Height)
|
||||
or (FLastResizeClientWidth<>ClientWidth)
|
||||
or (FLastResizeClientHeight<>ClientHeight) then begin
|
||||
if FormIsUpdating then begin
|
||||
Include(FControlFlags,cfOnResizeNeeded);
|
||||
exit;
|
||||
end;
|
||||
//if AnsiCompareText('NOTEBOOK',Name)=0 then
|
||||
{DebugLn('[TControl.Resize] ',Name,':',ClassName,
|
||||
{DebugLn(['[TControl.Resize] ',Name,':',ClassName,
|
||||
' Last=',FLastResizeWidth,',',FLastResizeHeight,
|
||||
' LastClient=',FLastResizeClientWidth,',',FLastResizeClientHeight,
|
||||
' New=',Width,',',Height,
|
||||
' NewClient=',ClientWidth,',',ClientHeight);}
|
||||
' NewClient=',ClientWidth,',',ClientHeight]);}
|
||||
FLastResizeWidth:=Width;
|
||||
FLastResizeHeight:=Height;
|
||||
FLastResizeClientWidth:=ClientWidth;
|
||||
@ -2612,6 +2628,16 @@ begin
|
||||
else inherited AssignTo(Dest);
|
||||
end;
|
||||
|
||||
procedure TControl.FormEndUpdated;
|
||||
// called when control is on a form and EndFormUpdate reached 0
|
||||
// it is called recursively
|
||||
begin
|
||||
if cfOnResizeNeeded in FControlFlags then
|
||||
Resize;
|
||||
if cfOnChangeBoundsNeeded in FControlFlags then
|
||||
CheckOnChangeBounds;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl SetBounds
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -694,6 +694,7 @@ procedure TCustomForm.EndFormUpdate;
|
||||
begin
|
||||
dec(FFormUpdateCount);
|
||||
if FFormUpdateCount=0 then begin
|
||||
FormEndUpdated;
|
||||
Visible:=(fsVisible in FFormState);
|
||||
end;
|
||||
end;
|
||||
@ -720,9 +721,9 @@ begin
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomForm.FormUpdating: boolean;
|
||||
function TCustomForm.FormIsUpdating: boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomForm.FormUpdating: boolean;
|
||||
function TCustomForm.FormIsUpdating: boolean;
|
||||
begin
|
||||
Result:=FFormUpdateCount>0;
|
||||
end;
|
||||
|
@ -5405,6 +5405,15 @@ begin
|
||||
ReAlign;
|
||||
end;
|
||||
|
||||
procedure TWinControl.FormEndUpdated;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
inherited FormEndUpdated;
|
||||
for i:=0 to ControlCount-1 do
|
||||
Controls[i].FormEndUpdated;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TWinControl.DestroyWnd
|
||||
Params: None
|
||||
|
Loading…
Reference in New Issue
Block a user