Managing the Tabs Collection
The TcxTabControl control maintains a collection of tabs. This topic covers the ways in which to manipulate tabs in the collection.
First of all it is worth noting that the tabs collection owned by the TcxTabControl control is represented by the Tabs property. Let’s consider the manner in which tabs are added and inserted into the collection - Add and Insert are used for this purpose. The following sample code adds three tabs to the TcxTabControl control.
with cxTabControl1.Tabs do
begin
Add('First Tab');
Add('Second Tab');
Insert(0, 'Third Tab');
end;
Execution of the code listed above will appear as follows:
Tabs can be deleted from the collection via the Delete method of the TcxTabs object. The following code deletes the first tab and the tab with caption ‘First Tab‘.
with cxTabControl1.Tabs do
begin
Delete(0);
Delete(IndexOf('First Tab'));
end;
Execution of the code listed above will appear as follows:
Note that you can also use the Clear method to remove all tabs from the collection.