From 3c9900948e31c76cc7b6ba3062b97b847f72e369 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 8 Sep 2013 19:34:22 +0000 Subject: [PATCH] LCL: PageControl, changing (moving) the tab position of a page, would sometimes (but not always) trigger OnChanging. OnChanging could prevent the change, while it must always be allowed during moving tabs. git-svn-id: trunk@42682 - --- lcl/comctrls.pp | 1 + lcl/include/customnotebook.inc | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 31f4afa997..343cba519b 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -416,6 +416,7 @@ type procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure ReadState(Reader: TReader); override; function DialogChar(var Message: TLMKey): boolean; override; + procedure InternalSetPageIndex(AValue: Integer); // No OnChange procedure ShowControl(APage: TControl); override; procedure UpdateTabProperties; virtual; class function GetControlClassDefaultSize: TSize; override; diff --git a/lcl/include/customnotebook.inc b/lcl/include/customnotebook.inc index 5e619f5d68..c116128d76 100644 --- a/lcl/include/customnotebook.inc +++ b/lcl/include/customnotebook.inc @@ -206,7 +206,7 @@ begin // update PageIndex if ActivePage <> nil then - FNotebook.PageIndex := IndexOfPage(ActivePage) + FNotebook.InternalSetPageIndex(IndexOfPage(ActivePage)) else // Can not restore an invalid page index. if FNotebook.PageIndex >= 0 then // keep if -1 FNotebook.PageIndex := NewIndex; @@ -578,9 +578,7 @@ begin if not CanChangePageIndex then exit; //debugln('TCustomTabControl.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated)); - FPageIndex := AValue; - UpdateAllDesignerFlags; - DoSendPageIndex; + InternalSetPageIndex(AValue); if ([csDesigning, csLoading, csDestroying] * ComponentState = []) then DoChange; end; @@ -977,6 +975,13 @@ begin Result := destPage.DialogChar(Message); end; +procedure TCustomTabControl.InternalSetPageIndex(AValue: Integer); +begin + FPageIndex := AValue; + UpdateAllDesignerFlags; + DoSendPageIndex; +end; + {------------------------------------------------------------------------------ TCustomTabControl CNNotify ------------------------------------------------------------------------------}