Search code examples
delphidelphi-xe8

Tabbed control for Delphi?


I'm using Delphi XE8.

I want to create a tabbed control, with each tab having its own panel. I tried TTabControl, for which I can create different tabs. But when I drop a component on the control with the first tab active, it remains visible when I change the tab (TabIndex). How can I in design time create different layouts for the different tabs? Or am I using the wrong component?


Solution

  • You are using the wrong component. You need to use TPageControl. Each page of a page control has its own distinct set of controls. From the documentation:

    TPageControl is a set of pages used to make a multiple page dialog box.

    Use TPageControl to create a multiple page dialog or tabbed notebook. TPageControl displays multiple overlapping pages that are TTabSheet objects. The user selects a page by clicking the page's tab that appears at the top of the control. To add a new page to a TPageControl object at design time, right-click the TPageControl object and choose New Page.

    To create a tabbed control that uses only a single body portion (page), use TTabControl instead.