Cocoa: Fix #40296: TCocoaWSCustomTabControl/TCocoaWSCustomPage issue on MacOS

This commit is contained in:
rich2014 2023-06-04 13:10:31 +08:00
parent dcbf685e78
commit 1741f14d55

View File

@ -85,6 +85,8 @@ type
published
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
class procedure AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); override;
class procedure MovePage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const NewIndex: integer); override;
class procedure RemovePage(const ATabControl: TCustomTabControl; const AIndex: integer); override;
@ -720,6 +722,15 @@ begin
end;
end;
class procedure TCocoaWSCustomTabControl.SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer);
begin
// because TCocoaWSCustomPage.SetBounds() is disabled
// all Pages should be invalidated in TCocoaWSCustomTabControl.SetBounds()
// see also: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40296
TCocoaWSWinControl.SetBounds( AWinControl, ALeft, ATop, AWidth, AHeight );
AWinControl.InvalidateClientRectCache(true);
end;
class procedure TCocoaWSCustomTabControl.AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer);
var
lTabControl: TCocoaTabControl;