Sign in Join
Wiki copytemporary

TNotebook: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-![](/wiki-images/5/5f/Tnotebook.png) **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]].
1+[![](/wiki-images/0/0f/TPageControlSeparatedDisplay.png)](</File:TPageControlSeparatedDisplay.png>)
22
3+[](</File:TPageControlSeparatedDisplay.png> "Enlarge")
4+
5+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]]
6+
7+[![tnotebook.png](/wiki-images/a/a4/tnotebook.png)](</File:tnotebook.png>) **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]].
8+
9+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.
10+
311## Navigating from page to page
412
5-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.
13+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.
614
7-Unlike [[TPageControl]] the `TNotebook` does not have tabs. Therefore, navigation between pages is not as easy as with `TPageControl`:
15+Unlike [[TPageControl]] the `TNotebook` does not have tabs. Therefore, navigation between pages is not as easy as with `TPageControl`:
816
9-- 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.
10-- At runtime, special code must be provided to show a specific page; the `PageIndex` property determines which page is currently visible. Here is an example for application of `TNotebook` in a tabless, wizard-like form with "Forward"/"Backward" buttons to move from page to page:
17+ * 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.
18+ * At runtime, special code must be provided to show a specific page; the `PageIndex` property determines which page is currently visible. Here is an example for application of `TNotebook` in a tabless, wizard-like form with "Forward"/"Backward" buttons to move from page to page:
1119
12-``` Pascal
20+```
1321procedure TForm1.ForwardBtnClick(Sender: TObject);
14-begin
15- if Notebook1.PageIndex < Notebook1.PageCount-1 then
16- Notebook1.PageIndex := Notebook1.PageIndex + 1;
17-end;
18-
19-procedure TForm1.BackwardBtnClick(Sender: TObject);
20-begin
21- if Notebook1.PageIndex > 0 then
22- Notebook1.PageIndex := Notebook1.PageIndex - 1;
23-end;
22+ begin
23+ if Notebook1.PageIndex < Notebook1.PageCount-1 then
24+ Notebook1.PageIndex := Notebook1.PageIndex + 1;
25+ end;
26+
27+ procedure TForm1.BackwardBtnClick(Sender: TObject);
28+ begin
29+ if Notebook1.PageIndex > 0 then
30+ Notebook1.PageIndex := Notebook1.PageIndex - 1;
31+ end;
2432```
2533
2634## Adding pages
2735
28-Pages can be added at designtime by right-clicking on the `TNotebook` component and selecting *Add Page* from the context menu.
29-
30-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:
36+Pages can be added at designtime by right-clicking on the `TNotebook` component and selecting _Add Page_ from the context menu.
3137
32-``` Pascal
38+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:
39+```
3340procedure TForm1.NewPageBtnClick(Sender: TObject);
34-var
35- newIndex: Integer;
36-begin
37- newIndex := Notebook1.Pages.Add('New Page'); // use plural!
38- with TMemo.Create(self) do
39- begin
40- Parent := Notebook1.Page[newIndex]; // use singular!
41- Align := alClient;
42- end;
43-end;
41+ var
42+ newIndex: Integer;
43+ begin
44+ newIndex := Notebook1.Pages.Add('New Page'); // use plural!
45+ with TMemo.Create(self) do
46+ begin
47+ Parent := Notebook1.Page[newIndex]; // use singular!
48+ Align := alClient;
49+ end;
50+ end;
4451```
4552
4653## Removing pages
4754
48-At designtime, a page can be removed by using the context menu of the `TNotebook` and selecting the menu item *Delete Page*.
49-
50-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
55+At designtime, a page can be removed by using the context menu of the `TNotebook` and selecting the menu item _Delete Page_.
5156
52-``` Pascal
57+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
58+```
5359procedure TForm1.DeleteCurrPageBtn(Sender: TObject);
54-begin
55- if Notebook1.PageIndex > -1 then
56- Notebook1.Pages.Delete(Notebook1.PageIndex);
57- // or: Notebook1.Page[Notebook1.PageIndex].Free
58- end;
59-end;
60+ begin
61+ if Notebook1.PageIndex > -1 then
62+ Notebook1.Pages.Delete(Notebook1.PageIndex);
63+ // or: Notebook1.Page[Notebook1.PageIndex].Free
64+ end;
65+ end;
6066```
6167
6268## Similar controls
6369
64-- [[TPageControl]]
65-- [[TTabControl]]
70+ * [[TPageControl]]
71+ * [[TTabControl]]
6672
6773## See also
6874
69-- [[doc:lcl/extctrls/tnotebook.html|TNoteBook doc]]
70-- [[doc:lcl/extctrls/multi-pagecontrols.html|Multi-page controls doc]]
75+ * [TNoteBook doc](<http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html> "doc:lcl/extctrls/tnotebook.html")
76+ * [Multi-page controls doc](<http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/multi-pagecontrols.html> "doc:lcl/extctrls/multi-pagecontrols.html")
77+ * [[Differences between multi-page controls]]
7178
79+
80+
81+[[LCL Components]] Component Tab | Components
82+---|---
83+[[Standard tab|Standard]] | [[TMainMenu]] • [[TPopupMenu]] • [[TButton]] • [[TLabel]] • [[TEdit]] • [[TMemo]] • [[TToggleBox]] • [[TCheckBox]] • [[TRadioButton]] • [[TListBox]] • [[TComboBox]] • [[TScrollBar]] • [[TGroupBox]] • [[TRadioGroup]] • [[TCheckGroup]] • [[TPanel]] • [[TFrame]] • [[TActionList]]
84+[[Additional tab|Additional]] | [[TBitBtn]] • [[TSpeedButton]] • [[TStaticText]] • [[TImage]] • [[TShape]] • [[TBevel]] • [[TPaintBox]] • TNotebook • [[TLabeledEdit]] • [[TSplitter]] • [[TTrayIcon]] • [[TControlBar]] • [[TFlowPanel]] • [[TMaskEdit]] • [[TCheckListBox]] • [[TScrollBox]] • [[TApplicationProperties]] • [[TStringGrid]] • [[TDrawGrid]] • [[TPairSplitter]] • [[TColorBox]] • [[TColorListBox]] • [[TValueListEditor]]
85+[[Common Controls tab|Common Controls]] | [[TTrackBar]] • [[TProgressBar]] • [[TTreeView]] • [[TListView]] • [[TStatusBar]] • [[TToolBar]] • [[TCoolBar]] • [[TUpDown]] • [[TPageControl]] • [[TTabControl]] • [[THeaderControl]] • [[TImageList]] • [[TPopupNotifier]] • [[TDateTimePicker]]
86+[[Dialogs tab|Dialogs]] | [[TOpenDialog]] • [[TSaveDialog]] • [[TSelectDirectoryDialog]] • [[TColorDialog]] • [[TFontDialog]] • [[TFindDialog]] • [[TReplaceDialog]] • [[TTaskDialog]] • [[TOpenPictureDialog]] • [[TSavePictureDialog]] • [[TCalendarDialog]] • [[TCalculatorDialog]] • [[TPrinterSetupDialog]] • [[TPrintDialog]] • [[TPageSetupDialog]]
87+[[Data Controls tab|Data Controls]] | [[TDBNavigator]] • [[TDBText]] • [[TDBEdit]] • [[TDBMemo]] • [[TDBImage]] • [[TDBListBox]] • [[TDBLookupListBox]] • [[TDBComboBox]] • [[TDBLookupComboBox]] • [[TDBCheckBox]] • [[TDBRadioGroup]] • [[TDBCalendar]] • [[TDBGroupBox]] • [[TDBGrid]] • [[TDBDateTimePicker]]
88+[[Data Access tab|Data Access]] | [[TDataSource]] • [[TCSVDataSet]] • [[TSdfDataSet]] • [[TBufDataset]] • [[TFixedFormatDataSet]] • [[TDbf]] • [[TMemDataset]]
89+[[System tab|System]] | [[TTimer]] • [[TIdleTimer]] • [[TLazComponentQueue]] • [[THTMLHelpDatabase]] • [[THTMLBrowserHelpViewer]] • [[TAsyncProcess]] • [[TProcessUTF8]] • [[TProcess]] • [[TSimpleIPCClient]] • [[TSimpleIPCServer]] • [[TXMLConfig]] • [[TEventLog]] • [[TServiceManager]] • [[TCHMHelpDatabase]] • [[TLHelpConnector]]
90+[[Misc tab|Misc]] | [[TColorButton]] • [[TSpinEdit]] • [[TFloatSpinEdit]] • [[TArrow]] • [[TCalendar]] • [[TEditButton]] • [[TFileNameEdit]] • [[TDirectoryEdit]] • [[TDateEdit]] • [[TTimeEdit]] • [[TCalcEdit]] • [[TFileListBox]] • [[TFilterComboBox]] • [[TComboBoxEx]] • [[TCheckComboBox]] • [[TButtonPanel]] • [[TShellTreeView]] • [[TShellListView]] • [[TXMLPropStorage]] • [[TINIPropStorage]] • [[TJSONPropStorage]] • [[TIDEDialogLayoutStorage]] • [[TMRUManager]] • [[TStrHolder]]
91+[[LazControls tab|LazControls]] | [[TCheckBoxThemed]] • [[TDividerBevel]] • [[TExtendedNotebook]] • [[TListFilterEdit]] • [[TListViewFilterEdit]] • [[TLvlGraphControl]] • [[TShortPathEdit]] • [[TSpinEditEx]] • [[TFloatSpinEditEx]] • [[TTreeFilterEdit]] • [[TExtendedTabControl]] •
92+[[RTTI tab|RTTI]] | [[TTIEdit]] • [[TTIComboBox]] • [[TTIButton]] • [[TTICheckBox]] • [[TTILabel]] • [[TTIGroupBox]] • [[TTIRadioGroup]] • [[TTICheckGroup]] • [[TTICheckListBox]] • [[TTIListBox]] • [[TTIMemo]] • [[TTICalendar]] • [[TTIImage]] • [[TTIFloatSpinEdit]] • [[TTISpinEdit]] • [[TTITrackBar]] • [[TTIProgressBar]] • [[TTIMaskEdit]] • [[TTIColorButton]] • [[TMultiPropertyLink]] • [[TTIPropertyGrid]] • [[TTIGrid]]
93+[[SQLdb tab|SQLdb]] | [[TSQLQuery]] • [[TSQLTransaction]] • [[TSQLScript]] • [[TSQLConnector]] • [[TMSSQLConnection]] • [[TSybaseConnection]] • [[TPQConnection]] • [[TPQTEventMonitor]] • [[TOracleConnection]] • [[TODBCConnection]] • [[TMySQL40Connection]] • [[TMySQL41Connection]] • [[TMySQL50Connection]] • [[TMySQL51Connection]] • [[TMySQL55Connection]] • [[TMySQL56Connection]] • [[TMySQL57Connection]] • [[TSQLite3Connection]] • [[TIBConnection]] • [[TFBAdmin]] • [[TFBEventMonitor]] • [[TSQLDBLibraryLoader]]
94+[[Pascal Script tab|Pascal Script]] | [[TPSScript]] • [[TPSScriptDebugger]] • [[TPSDllPlugin]] • [[TPSImport Classes]] • [[TPSImport DateUtils]] • [[TPSImport ComObj]] • [[TPSImport DB]] • [[TPSImport Forms]] • [[TPSImport Controls]] • [[TPSImport StdCtrls]] • [[TPSCustomPlugin]]
95+[[SynEdit tab|SynEdit]] | [[TSynEdit]] • [[TSynCompletion]] • [[TSynAutoComplete]] • [[TSynMacroRecorder]] • [[TSynExporterHTML]] • [[TSynPluginSyncroEdit]] • [[TSynPasSyn]] • [[TSynFreePascalSyn]] • [[TSynCppSyn]] • [[TSynJavaSyn]] • [[TSynPerlSyn]] • [[TSynHTMLSyn]] • [[TSynXMLSyn]] • [[TSynLFMSyn]] • [[TSynDiffSyn]] • [[TSynUNIXShellScriptSyn]] • [[TSynCssSyn]] • [[TSynPHPSyn]] • [[TSynTeXSyn]] • [[TSynSQLSyn]] • [[TSynPythonSyn]] • [[TSynVBSyn]] • [[TSynAnySyn]] • [[TSynMultiSyn]] • [[TSynBatSyn]] • [[TSynIniSyn]] • [[TSynPoSyn]]
96+[[Chart tab|Chart]] | [[TChart]] • [[TListChartSource]] • [[TRandomChartSource]] • [[TUserDefinedChartSource]] • [[TCalculatedChartSource]] • [[TDbChartSource]] • [[TChartToolset]] • [[TChartAxisTransformations]] • [[TChartStyles]] • [[TChartLegendPanel]] • [[TChartNavScrollBar]] • [[TChartNavPanel]] • [[TIntervalChartSource]] • [[TDateTimeIntervalChartSource]] • [[TChartListBox]] • [[TChartExtentLink]] • [[TChartImageList]]
97+[[IPro tab|IPro]] | [[TIpFileDataProvider]] • [[TIpHtmlDataProvider]] • [[TIpHttpDataProvider]] • [[TIpHtmlPanel]]
98+[[Virtual Controls tab|Virtual Controls]] | [[TVirtualDrawTree]] • [[TVirtualStringTree]] • [[TVTHeaderPopupMenu]]
99+
72100---
73-*From the Free Pascal wiki, page "TNotebook", as it stood on 2021-02-06 after a change by Wp, out of the wiki's dump of 2024-05-26. 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](/wiki-contact).*
101+*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](/wiki-contact).*

Back to history