mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:00:27 +02:00
Cocoa/TabControl: add triggeringByLCL to distinguish whether the operation is triggered by User or Program
This commit is contained in:
parent
82d467b50c
commit
cbb27a8f6d
@ -58,6 +58,8 @@ type
|
|||||||
nextarr : NSButton;
|
nextarr : NSButton;
|
||||||
|
|
||||||
public
|
public
|
||||||
|
triggeringByLCL: Boolean;
|
||||||
|
|
||||||
{ various indexes in fulltabs }
|
{ various indexes in fulltabs }
|
||||||
currentIndex : Integer; // index of the current tab
|
currentIndex : Integer; // index of the current tab
|
||||||
visibleLeftIndex: Integer; // index shown in TabView on the left
|
visibleLeftIndex: Integer; // index shown in TabView on the left
|
||||||
@ -633,6 +635,9 @@ procedure TCocoaTabControl.tabView_didSelectTabViewItem(tabView: NSTabView;
|
|||||||
begin
|
begin
|
||||||
//it's called together with "willSelect"
|
//it's called together with "willSelect"
|
||||||
|
|
||||||
|
if triggeringByLCL then
|
||||||
|
exit;
|
||||||
|
|
||||||
currentIndex:= IndexOfTab( self, tabViewItem );
|
currentIndex:= IndexOfTab( self, tabViewItem );
|
||||||
leftKeepAmount:= currentIndex - visibleLeftIndex;
|
leftKeepAmount:= currentIndex - visibleLeftIndex;
|
||||||
|
|
||||||
@ -858,6 +863,8 @@ var
|
|||||||
nextTabPage: NSTabViewItem;
|
nextTabPage: NSTabViewItem;
|
||||||
prevTabPage: NSTabViewItem;
|
prevTabPage: NSTabViewItem;
|
||||||
begin
|
begin
|
||||||
|
triggeringByLCL:= true;
|
||||||
|
try
|
||||||
removedIndex := exttabIndexOfTabViewItem( removedTabPage );
|
removedIndex := exttabIndexOfTabViewItem( removedTabPage );
|
||||||
isRemovingCurrentPage:= (removedIndex=currentIndex);
|
isRemovingCurrentPage:= (removedIndex=currentIndex);
|
||||||
|
|
||||||
@ -913,6 +920,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateTabAndArrowVisibility( self );
|
UpdateTabAndArrowVisibility( self );
|
||||||
|
finally
|
||||||
|
triggeringByLCL:= false;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaTabControl.exttabIndexOfTabViewItem(lTabPage: NSTabViewItem
|
function TCocoaTabControl.exttabIndexOfTabViewItem(lTabPage: NSTabViewItem
|
||||||
|
Loading…
Reference in New Issue
Block a user