Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.

Delphi
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‘.

Delphi
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.