LCL: reapply patch from Chronos to update PageIndex in PageControl after setting TabVisible. Issue #23251

git-svn-id: trunk@39883 -
This commit is contained in:
juha 2013-01-19 00:21:51 +00:00
parent 8e1595bae1
commit ca2fc53e25

View File

@ -54,6 +54,8 @@ begin
end;
procedure TCustomPage.SetTabVisible(const AValue: Boolean);
var
TabCntrl: TCustomTabControl;
begin
if AValue = FTabVisible then Exit;
FTabVisible := AValue;
@ -63,16 +65,17 @@ begin
if Assigned(Parent) and Parent.HandleAllocated then
begin
TabCntrl := Parent as TCustomTabControl;
if FTabVisible then
begin
// check if there was no visible tab
if TCustomTabControl(Parent).PageIndex = -1 then
TCustomTabControl(Parent).PageIndex:=PageIndex;
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;
end
else
// Check if the page is active and set a new pageindex
TCustomTabControl(Parent).PageRemoved(PageIndex);
TCustomTabControl(Parent).AddRemovePageHandle(Self);
else // Check if the page is active and set a new pageindex
TabCntrl.PageRemoved(PageIndex);
TabCntrl.AddRemovePageHandle(Self);
end;
end;