diff --git a/ideintf/propedits.pp b/ideintf/propedits.pp index 3fc808173c..7a4ae6da6d 100644 --- a/ideintf/propedits.pp +++ b/ideintf/propedits.pp @@ -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; diff --git a/lcl/controls.pp b/lcl/controls.pp index b6c7646718..3abbe6473a 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -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 diff --git a/lcl/forms.pp b/lcl/forms.pp index 97e3f0fff2..d42a106acd 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -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; diff --git a/lcl/include/control.inc b/lcl/include/control.inc index f81f082113..362a3976dc 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -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 ------------------------------------------------------------------------------} diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 6303f914b7..d8305cb8cc 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -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; diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 7d5ddbd916..1a19621970 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -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