Skip to main content
All docs
V26.1
  • Tab Control Tutorial

    • 2 minutes to read

    This tutorial creates a simple tabbed user interface using the TcxTabControl component.

    VCL Page Control: A Tab Control-Based Application Example

    Step 1 — Create Tabs

    Place a TcxTabControl component on a form.

    VCL Page Control: A Form with a Tab Control

    Expand the Properties node and click the ellipsis button at the Properties.Tabs property to display the String List Editor dialog. Specify four tab captions as follows:

    VCL Page Control: Define a Tab Layout

    Click the OK button to save pending changes and close the dialog.

    VCL Page Control: A Configured Tab Layout

    Step 2 — Add and Display Tab Glyphs

    Place a TcxImageList component. Double-click the image list and use the editor to load four glyphs from the DevExpress Icon Library.

    VCL Page Control: The Image List Editor

    Tip

    Refer to the following help topic for detailed information on image list management: Image List Editor.

    Assign the populated TcxImageList component to the Properties.Images property of the TcxTabControl to display loaded glyphs in corresponding tabs.

    VCL Page Control: Assign the Populated Image List

    All images from the assigned list are automatically assigned to created tabs:

    VCL Page Control: Assigned Tab Glyphs

    Step 3 — Display Tab-Dependent Content

    1. Place TcxLabel and TcxTextEdit components on the visible TcxTabControl page.
    2. Set the TcxLabel component’s caption to 'Selected tab index is: '.
    3. Clear the TcxTextEdit component’s edit value.

    VCL Page Control: Place Content Components

    Handle the TcxTabControl component’s OnChange event as follows to display tab indexes when corresponding tabs are active:

    procedure TMyForm.cxTabControl1Change(Sender: TObject);
    begin
      cxTextEdit1.EditingText := IntToStr(cxTabControl1.TabIndex);
    end;
    

    Step 4 — Run & Test the App

    Build and run the application. Click tabs to switch between them.

    VCL Page Control: A Tab Control-Based Application Example

    See Also