diff --git a/lcl/include/customnotebook.inc b/lcl/include/customnotebook.inc index b310ef7ffd..52df1333fa 100644 --- a/lcl/include/customnotebook.inc +++ b/lcl/include/customnotebook.inc @@ -449,9 +449,9 @@ procedure TCustomNotebook.SetOptions(const AValue: TNoteBookOptions); var ChangedOptions: TNoteBookOptions; begin - if FOptions=AValue then exit; - ChangedOptions:=(FOptions-AValue)+(AValue-FOptions); - FOptions:=AValue; + if FOptions = AValue then Exit; + ChangedOptions := (FOptions - AValue) + (AValue - FOptions); + FOptions := AValue; if nboShowCloseButtons in ChangedOptions then UpdateTabProperties; if HandleAllocated then diff --git a/lcl/interfaces/win32/win32wsextctrls.pp b/lcl/interfaces/win32/win32wsextctrls.pp index 9cc90c9d12..dd172dbd10 100644 --- a/lcl/interfaces/win32/win32wsextctrls.pp +++ b/lcl/interfaces/win32/win32wsextctrls.pp @@ -474,7 +474,8 @@ begin // clientrect possible changed, adding first tab, or deleting last // windows should send a WM_SIZE message because of this, but it doesn't // send it ourselves - LCLControlSizeNeedsUpdate(ANotebook, True); + if LCLControlSizeNeedsUpdate(ANotebook, True) then + AdjustSizeNotebookPages(ANotebook); end; end; @@ -489,6 +490,8 @@ class procedure TWin32WSCustomNotebook.RemovePage(const ANotebook: TCustomNotebo const AIndex: integer); begin Windows.SendMessage(ANotebook.Handle, TCM_DELETEITEM, Windows.WPARAM(AIndex), 0); + if LCLControlSizeNeedsUpdate(ANotebook, True) then + AdjustSizeNotebookPages(ANotebook); end; { ----------------------------------------------------------------------------- @@ -726,7 +729,8 @@ begin begin SetWindowLong(ANotebook.Handle, GWL_STYLE, NewStyle); SetWindowPos(ANoteBook.Handle, 0, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_DRAWFRAME); - LCLControlSizeNeedsUpdate(ANotebook, True); + if LCLControlSizeNeedsUpdate(ANotebook, True) then + AdjustSizeNotebookPages(ANotebook); end; end;