In the code attached I have a FNCPageControl with the tab of Page 3 set to not visible at start-up. The button sets the visible state of the Page 3 tab to true and this works 100%.
The OnChangePage event is then used to set the visible state of the Page 3 tab to false if any other tab is selected. You can see on the page control you can't access Page 3 once you have clicked on any of the other tabs, but the tab stays visible. How can I make the tab hidden again?
Demo.zip (54.4 KB)
The tab is still displayed, but no longer responds. was it forgotten to delete the tab here?
ACurrentPageIndex: Integer);
begin
if ACurrentPageIndex < 1
then begin
fncPageControl.Pages[2].TabVisible := False;
end;
Showmessage(intToStr(ACurrentPageIndex));
end;
Changing the visibility of a tab during the tab change event is not possible unfortunately. You can do this in the OnClick event:
procedure TForm1.TMSFNCPageControl1Click(Sender: TObject);
begin
if TMSFNCPageControl1.ActivePageIndex < 2 then
tmsfncpagecontrol1.Pages[2].TabVisible := False;
end;