diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index fac878f4d3..04e4563673 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -70,6 +70,7 @@ type procedure DoHide; dynamic; procedure DoShow; dynamic; procedure DestroyHandle; override; + procedure RealSetText(const AValue: TCaption); override; public constructor Create(TheOwner: TComponent); override; procedure AdjustClientRect(var ARect: TRect); override; diff --git a/lcl/include/custompage.inc b/lcl/include/custompage.inc index 36b406de39..43797b1f45 100644 --- a/lcl/include/custompage.inc +++ b/lcl/include/custompage.inc @@ -203,6 +203,18 @@ begin Exclude(FFlags,pfAdded); end; +procedure TCustomPage.RealSetText(const AValue: TCaption); +begin + if (Parent <> nil) and Parent.HandleAllocated and (not (csLoading in ComponentState)) then + begin + WSSetText(AValue); + InvalidatePreferredSize; + inherited RealSetText(AValue); + AdjustSize; + end + else inherited RealSetText(AValue); +end; + function TCustomPage.IsControlVisible: Boolean; begin if Parent is TCustomNotebook then