Revision 2 of 2, by WikiArchive on 11-10-2026. The page as it is now.
TNotebook
/File:TPageControlSeparatedDisplay.png
Example renderings of TPageControl and TTabControl with TNotebook. TNotebook is providing subpages (TPage) independently of the tab header, while in TPageControl the TTabSheets are directly tied to the tab buttons. TNotebook thus providing greater flexibility in different use cases. TTabHeader and TNotebook can be nested to visually appear as a combined control like TPageControl. TMemos added as examples here to show the rendering area. Details in Differences between multi-page controls
TNoteBook is a component that provides a container to hold a variety of controls arranged in pages, much like a real-world notebook. It is a descendant of TWinControl and is available under the Additional tab of the Component Palette.
Note also that there is a TExtendedNotebook on the LazControls tab which again provides a combined functionality of tab header buttons and content organized in pages, much like TPageControl does.
Navigating from page to page
All pages of the TNotebook are listed by the Pages property, a TStrings class which contains the page names. There is also a property Page (note the singular!) which lists the TPage controls into which other controls can be inserted.
Unlike TPageControl the TNotebook does not have tabs. Therefore, navigation between pages is not as easy as with TPageControl:
- At designtime the pages are listed in the object tree of the Object Inspector under the Notebook node; here the developer can easily switch from page to page.
- At runtime, special code must be provided to show a specific page; the
PageIndexproperty determines which page is currently visible. Here is an example for application ofTNotebookin a tabless, wizard-like form with "Forward"/"Backward" buttons to move from page to page:
procedure TForm1.ForwardBtnClick(Sender: TObject);
begin
if Notebook1.PageIndex < Notebook1.PageCount-1 then
Notebook1.PageIndex := Notebook1.PageIndex + 1;
end;
procedure TForm1.BackwardBtnClick(Sender: TObject);
begin
if Notebook1.PageIndex > 0 then
Notebook1.PageIndex := Notebook1.PageIndex - 1;
end;Adding pages
Pages can be added at designtime by right-clicking on the TNotebook component and selecting Add Page from the context menu.
At runtime, a page is added by calling Notebook.Add('new pagename') with the name of the new page as parameter; the function returns the index of the new page. As already noted, the new page itself can be addressed by using the property Notebook.Page[newindex] (note the singular). The following example adds a new page and puts a TMemo on it:
procedure TForm1.NewPageBtnClick(Sender: TObject);
var
newIndex: Integer;
begin
newIndex := Notebook1.Pages.Add('New Page'); // use plural!
with TMemo.Create(self) do
begin
Parent := Notebook1.Page[newIndex]; // use singular!
Align := alClient;
end;
end;Removing pages
At designtime, a page can be removed by using the context menu of the TNotebook and selecting the menu item Delete Page.
At runtime, a page is removed by deleting the corresponding index from the Pages list (plural!), or by destroying the Page[index] (singular!) at the specific index
procedure TForm1.DeleteCurrPageBtn(Sender: TObject);
begin
if Notebook1.PageIndex > -1 then
Notebook1.Pages.Delete(Notebook1.PageIndex);
// or: Notebook1.Page[Notebook1.PageIndex].Free
end;
end;Similar controls
See also
From the Free Pascal wiki, page "TNotebook", as the Internet Archive kept it on 2025-06-16, last changed on 2024-11-18. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

