Difference between revisions of "TPageControl"
m |
m |
||
Line 8: | Line 8: | ||
The current (active) page is accessible through the ''ActivePage'' property. | The current (active) page is accessible through the ''ActivePage'' property. | ||
+ | ==Deleting a page== | ||
+ | There are different ways of "deleting" a page from a tabsheet. | ||
+ | All the approaches listed below would cause the target page tab to disappear from the control. Giving the end-user an effect of ''deleting'' a page. Though the page might remain available in the code. | ||
+ | ===Hide the tab=== | ||
+ | The code simply hides the tab from TabControl. Meaning the user will not longer be able to select it manually. | ||
+ | <source lang="pascal"> | ||
+ | Tabsheet2.TabVisible := false; | ||
+ | </source> | ||
+ | ===Changing the Parent=== | ||
+ | You can change Tab's parent to a different or control or event to '''nil''' | ||
+ | The method is useful when you need to move the sheet from one TabControl to another. OR you want to show the page again later. OR you just need to keep controls intact. | ||
+ | <source lang="pascal"> | ||
+ | Tabsheet2.Parent := nil; | ||
+ | </source> | ||
+ | ===Freeing the page=== | ||
+ | The method can be used when you don't need the control itself anymore (as well as it's children) | ||
+ | <source lang="pascal"> | ||
+ | TabSheet2.Free; | ||
+ | TabSheet2:=nil; // this is optional | ||
+ | </source> | ||
==See also== | ==See also== |
Revision as of 17:16, 18 June 2019
│
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
中文(中国大陆) (zh_CN) │
TPageControl is a component that provides a container to hold pages, much like a real-world notebook. TPageControl is a descendant of TWinControl and is available under the Common Controls tab of the Component Palette.
Unlike a TTabControl, each tab is connected to its own page. Pages (TTabSheets) from a TPageControl are accessible through its (non published) Pages property. Right-click on a TPageControl to show its context menu, and use 'Add Page' to create a new page.
The current (active) page is accessible through the ActivePage property.
Deleting a page
There are different ways of "deleting" a page from a tabsheet. All the approaches listed below would cause the target page tab to disappear from the control. Giving the end-user an effect of deleting a page. Though the page might remain available in the code.
Hide the tab
The code simply hides the tab from TabControl. Meaning the user will not longer be able to select it manually.
Tabsheet2.TabVisible := false;
Changing the Parent
You can change Tab's parent to a different or control or event to nil The method is useful when you need to move the sheet from one TabControl to another. OR you want to show the page again later. OR you just need to keep controls intact.
Tabsheet2.Parent := nil;
Freeing the page
The method can be used when you don't need the control itself anymore (as well as it's children)
TabSheet2.Free;
TabSheet2:=nil; // this is optional
See also