lcl: handle the case where the design time TPageControl.PageIndex is set to a TabSheet with TabVisible = False

git-svn-id: trunk@39679 -
This commit is contained in:
blikblum 2012-12-29 11:21:59 +00:00
parent ef24adff3a
commit afe0a4ea69

View File

@ -552,9 +552,9 @@ end;
------------------------------------------------------------------------------}
procedure TCustomTabControl.SetPageIndex(AValue: Integer);
begin
if (AValue < -1) or (AValue >= PageCount) then Exit;
if (csLoading in ComponentState) then FLoadedPageIndex := AValue;
//debugln('TCustomTabControl.SetPageIndex A ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated),' ',dbgs(ComponentState));
if (AValue < -1) or (AValue >= PageCount) then Exit;
if FPageIndex = AValue then exit;
if not CanChangePageIndex then exit;
//debugln('TCustomTabControl.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated));
@ -937,8 +937,8 @@ end;
procedure TCustomTabControl.Loaded;
begin
inherited Loaded;
if FLoadedPageIndex >= -1 then
PageIndex := FLoadedPageIndex;
if FLoadedPageIndex > -1 then
PageIndex := FindVisiblePage(FLoadedPageIndex);
FLoadedPageIndex := -1;
//DebugLn(['TCustomTabControl.Loaded ',DbgSName(Self),' fPageIndex=',fPageIndex]);
FPageIndexOnLastChange := PageIndex;