Discussion:
Hide page control tabsheet headers
(too old to reply)
Alan
2003-12-17 23:22:59 UTC
Permalink
How do I hide the headers of each tab sheets in TPageControl ?
Arno Verhoeven
2003-12-18 06:59:20 UTC
Permalink
Post by Alan
How do I hide the headers of each tab sheets in TPageControl ?
procedure HideTabs(MyPageControl: TPageControl);
var
I : Integer;
begin
for I := 0 to (MyPageControl.ControlCount - 1) do
if MyPageControl.Controls[I] is TTabSheet then
TTabSheet(MyPageControl.Controls[I]).TabVisible := False
end;

HTH

Arno
Alan
2003-12-18 22:35:29 UTC
Permalink
Sorry, I am looking for to make the header of tabsheet invisible but not
the whole tab sheet.
Post by Arno Verhoeven
Post by Alan
How do I hide the headers of each tab sheets in TPageControl ?
procedure HideTabs(MyPageControl: TPageControl);
var
I : Integer;
begin
for I := 0 to (MyPageControl.ControlCount - 1) do
if MyPageControl.Controls[I] is TTabSheet then
TTabSheet(MyPageControl.Controls[I]).TabVisible := False
end;
HTH
Arno
Robert
2003-12-18 23:12:14 UTC
Permalink
Post by Alan
Sorry, I am looking for to make the header of tabsheet invisible but not
the whole tab sheet.
tabControl1.Tabs.Delete(2);

Make sure you save the values if you'll need to restore. Also, obviously you
can't rely anymore on the index number (in the example above, what was three
becomes 2), so OnChange you have to look at the tab string values to
determine where you are.

Robert
Alan
2003-12-19 02:11:43 UTC
Permalink
Sorry, I think I didn't make my question clearly:
I want to keep all my tab sheets in my TPageControl visible BUT can select
the individual programmatically, so I want to hide the tab sheets headers.
That means the user cannot click on the headers to select individual tab
sheet.
Post by Robert
Post by Alan
Sorry, I am looking for to make the header of tabsheet invisible but not
the whole tab sheet.
tabControl1.Tabs.Delete(2);
Make sure you save the values if you'll need to restore. Also, obviously you
can't rely anymore on the index number (in the example above, what was three
becomes 2), so OnChange you have to look at the tab string values to
determine where you are.
Robert
Robert
2003-12-19 04:18:59 UTC
Permalink
Yeah, afraid so. Are you using a Pagecontrol, or a TabControl?

If you are using a TabControl, then you use the procedure I outlined in my
last posting. If you are using a PageControl (seems to be the case), each
TabSheet is a separate object. The following code will hide the tab on page
2, and then make that page your active page.

TabSheet2.TabVisible := False;
PageControl1.ActivePageIndex := 1;

Robert
Tony J Hopkinson
2003-12-19 19:41:43 UTC
Permalink
On Fri, 19 Dec 2003 13:11:43 +1100, "Alan"
Post by Alan
I want to keep all my tab sheets in my TPageControl visible BUT can select
the individual programmatically, so I want to hide the tab sheets headers.
That means the user cannot click on the headers to select individual tab
sheet.
Are you are saying you don't want the user to be able to switch
between tabs and therefore want to hide the tab 'the sticky up bit'
in technical jargon so they can't click on an other.

If so the use the tab visible property so only one tab is visible at
time.
If you want to layout all the tabs but only provide access to one at a
time, then you could code that in the onchanging to ignore the users
selection. Don't forget that this event will fire when you switch tabs
programmatically.

Last but not least in my opinnion. Set ownerdraw on the page control
and then add some code to the ondrawtab event. do something in it to
lett the user know that the the tab isn't selectable.

If you want to get rid of the tab (sticky up bit) altogether then you
are using the wrong control, though I can't think of one off hand that
would do what you want which would be some sort of collection of
Tpanels I suppose.
Peter Below (TeamB)
2003-12-19 17:43:46 UTC
Permalink
Post by Alan
Sorry, I am looking for to make the header of tabsheet invisible but not
the whole tab sheet.
The code posted does exactly that. The TabVisible property hides or shows
the tab. You can still show the tabsheet in code, by changing the
pagecontrols ActivePage or ActivePageIndex properties.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Alan
2003-12-22 02:56:15 UTC
Permalink
I got no luck.
I used the tabvisible := FALSE
but still got the error.
Post by Peter Below (TeamB)
Post by Alan
Sorry, I am looking for to make the header of tabsheet invisible but not
the whole tab sheet.
The code posted does exactly that. The TabVisible property hides or shows
the tab. You can still show the tabsheet in code, by changing the
pagecontrols ActivePage or ActivePageIndex properties.
--
Peter Below (TeamB)
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Loading...