From aecd84036ee04be26b94e0a1cfd491a291b8886b Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 18 Apr 2019 03:59:20 +0000 Subject: [PATCH] cocoa: fix tabVisible for active page. Patch by David Jenkins #35172 git-svn-id: trunk@61009 - --- lcl/interfaces/cocoa/cocoatabcontrols.pas | 2 ++ lcl/interfaces/cocoa/cocoawscomctrls.pas | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoatabcontrols.pas b/lcl/interfaces/cocoa/cocoatabcontrols.pas index b08ca1c222..8fc70787ef 100644 --- a/lcl/interfaces/cocoa/cocoatabcontrols.pas +++ b/lcl/interfaces/cocoa/cocoatabcontrols.pas @@ -59,6 +59,7 @@ type leftmost : Integer; // index of the left-most tab shown public + ignoreChange: Boolean; callback: ITabControlCallback; fulltabs : NSMutableArray; // the full list of NSTabViewItems @@ -466,6 +467,7 @@ end; procedure TCocoaTabControl.tabView_willSelectTabViewItem(tabView: NSTabView; tabViewItem: NSTabViewItem); begin + if ignoreChange then Exit; if Assigned(callback) then begin callback.willSelectTabViewItem( IndexOfTab( self, tabViewItem) ); diff --git a/lcl/interfaces/cocoa/cocoawscomctrls.pas b/lcl/interfaces/cocoa/cocoawscomctrls.pas index 4881fefc1d..99aa244bc2 100644 --- a/lcl/interfaces/cocoa/cocoawscomctrls.pas +++ b/lcl/interfaces/cocoa/cocoawscomctrls.pas @@ -815,7 +815,9 @@ begin i := TCocoaTabControl(ATabControl.Handle).fulltabs.indexOfObject( tb.tabPage ); if (i = NSNotFound) then Exit; + TCocoaTabControl(ATabControl.Handle).ignoreChange := True; TCocoaTabControl(ATabControl.Handle).extselectTabViewItemAtIndex(NSInteger(i)); + TCocoaTabControl(ATabControl.Handle).ignoreChange := False; end; class procedure TCocoaWSCustomTabControl.SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition);