I wonder how can I hide the headers of the TabSheets in PageControl component. I want make a creator e.g to build your champion where you can choose some stuff on the pages. TabSheets will be change every 10 s by Timer. In Google I can find only how hide TabSheet(with contents). I want hide only header of the TabSheets e.gTabSheet1 and so on. I'm working in C++ Builder. Greetings,
Asked
Active
Viewed 5,205 times
1 Answers
5
You can hide every page of the TPageControl
(TabVisible
property of the TabSheet
) and you can still show the Tabsheet
in code, by changing the ActivePage
or ActivePageIndex
properties of the page control.
The Timer can call the SelectNextPage
method to programmatically change the active page:
PageControl1->SelectNextPage(true, false);
EDIT
A simple form (Form1
) with a TPageControl
(as appears in the designer):
The code to hide the header:
void __fastcall TForm1::FormShow(TObject *Sender)
{
for (int i(0); i < PageControl1->PageCount; ++i)
PageControl1->Pages[i]->TabVisible = false;
// You can show the TabSheet programmatically changing the active page.
PageControl1->ActivePage = TabSheet1;
}
The code to select the next page:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
PageControl1->SelectNextPage(true, false);
}
The wizard-like effect (at runtime):
Recent versions of C++Builder have the TCardPanel
control. It's a set of pages, like the TPageControl
, with no tabs. You display one page at a time (each hosting its own controls) and it has built in support for swiping pages using a gesture.

manlio
- 18,345
- 14
- 76
- 126
-
Yes I know. I call the SelectNextPage method. I still have the header of the TabSheet. I want only the Sheet with content without header e.g TabSheet1 – Lukas Apr 30 '15 at 11:42
-
Edit* Now I do not have headers of the TabSheets but also I do not see the content of the TabSheets – Lukas Apr 30 '15 at 12:00
-
@Lukas I added a small example – manlio May 02 '15 at 09:15
-
1Just for the record - this didn't work for me until I had PageControl1->ActivePageIndex = 0; (or PageControl1->ActivePage = TabSheet1; as above) – Reversed Engineer Jun 21 '17 at 14:53
-
This also works for me in Delphi 5 – pyfyc Sep 30 '21 at 05:39