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 -
This commit is contained in:
martin 2013-09-08 19:34:22 +00:00
parent 5364c52f95
commit 3c9900948e
2 changed files with 10 additions and 4 deletions

View File

@ -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;

View File

@ -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
------------------------------------------------------------------------------}