From ff9256aff647dbc30e0f9889a3d9f791d0955b84 Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 18 Apr 2019 03:47:21 +0000 Subject: [PATCH] cocoa: adding support for removal tabs by freeing handle. Patch by David Jenkins. #35171 git-svn-id: trunk@61008 - --- lcl/interfaces/cocoa/cocoawscomctrls.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawscomctrls.pas b/lcl/interfaces/cocoa/cocoawscomctrls.pas index ad505357c6..4881fefc1d 100644 --- a/lcl/interfaces/cocoa/cocoawscomctrls.pas +++ b/lcl/interfaces/cocoa/cocoawscomctrls.pas @@ -63,6 +63,7 @@ type class function GetCocoaTabPageFromHandle(AHandle: HWND): TCocoaTabPage; published class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; + class procedure DestroyHandle(const AWinControl: TWinControl); override; class procedure UpdateProperties(const ACustomPage: TCustomPage); override; class procedure SetProperties(const ACustomPage: TCustomPage; ACocoaControl: NSTabViewItem); // @@ -582,6 +583,18 @@ begin end; end; +class procedure TCocoaWSCustomPage.DestroyHandle(const AWinControl: TWinControl); +var + tv: TCocoaTabPageView; + ndx: Integer; +begin + tv := TCocoaTabPageView(AWinControl.Handle); + ndx := tv.tabView.exttabIndexOfTabViewItem(tv.tabPage); + if ndx >= 0 then + tv.tabview.exttabRemoveTabViewItem(tv.tabPage); + TCocoaWSWinControl.DestroyHandle(AWinControl); +end; + class procedure TCocoaWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage); var lTabPage: TCocoaTabPage;