LCL: PageControl revert Revision: 39883 [" update PageIndex in PageControl after setting TabVisible. Issue #23251 2]. See note 69758 on the issue

git-svn-id: trunk@42624 -
This commit is contained in:
martin 2013-09-05 22:02:31 +00:00
parent 6f7482518a
commit 920a610a6c

View File

@ -48,28 +48,25 @@ begin
end;
procedure TCustomPage.SetTabVisible(const AValue: Boolean);
var
TabCntrl: TCustomTabControl;
begin
if AValue = FTabVisible then Exit;
FTabVisible := AValue;
if csDesigning in ComponentState then
Exit;
if Assigned(Parent) and Parent.HandleAllocated then
begin
TabCntrl := Parent as TCustomTabControl;
if FTabVisible then
begin // check if there was no visible tab
if TabCntrl.PageIndex = -1 then
TabCntrl.PageIndex := PageIndex
else if TabCntrl.PageIndex >= PageIndex then
TabCntrl.PageIndex := TabCntrl.PageIndex + 1;
begin
// check if there was no visible tab
if TCustomTabControl(Parent).PageIndex = -1 then
TCustomTabControl(Parent).PageIndex:=PageIndex;
end
else // Check if the page is active and set a new pageindex
TabCntrl.PageRemoved(PageIndex);
TabCntrl.AddRemovePageHandle(Self);
else
// Check if the page is active and set a new pageindex
TCustomTabControl(Parent).PageRemoved(PageIndex);
TCustomTabControl(Parent).AddRemovePageHandle(Self);
end;
end;