Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

TTDINotebook

TTDINotebook is a component that provides a Tabbed Document Interface (TDI).

Lazarus does not have full support for MDI interface yet, and commercial applications need to open several windows at once without ShowModal.

However, the MDI interface concept has several problems, which may confuse the novice user. A more complete study on the advantages and disadvantages of the MDI can be found at wikipedia.

The intention of this component is to provide a simple way to create an TDI interface, similar to that described in Wikipedia.

I used TExtendedNotebook as a base component, introducing new methods and properties to provide support for TDI. Very few changes will be needed in your code, and component TTDINotebook will handle the entire process of creation and destruction of the tabs and menus automatically.

Author
Daniel Simões de Almeida - daniel @ projetoacbr.com.br

License
LGPL

Key Features

Download

Dependencies / System Requirements

Screenshot

Installation

How to Use

Methods and Properties

Show a already created Form in a new Page. If there is an Page that already owns this Form variable, it will bring it to front, rather than create a new Page.


Create a New AFormClass, in a new Page. ( Remember to assign CloseAction := caFree; on OnClose event of this Form)


This will fire OnCloseQuery of the Internal Form reference to a APageIndex Tab, and Returns True if it can be Closed.


Search an Page that owns AForm variable, returning the TabIndex if found or -1 if doesn't.


The same as above, but will check All Tabs


Go to Next ou Prior Page, depending ToForward parameter


Check the TDI Interface, enabling/disabling internal components (This method is called from inside)



TTDIBackgroundCorner = (coTopLeft, coTopRight, coBottomLeft, coBottomRight);


If Assigned, TTDINotebook will use it to Create Menu Items for Tabs operations (see Image1)


TTDICloseTabButtom = (tbNone, tbMenu, tbButtom ) ;
tbNone - None Close Button is showed
tbMenu - Use MainMenu, to draw a Close Button aligned to Right (see Image1)
tbButtom - Draw a small BitButtom, on Right Up corner of TTDINotebook


Allow to customize Label and Images of Menu Items for operations:
TabsMenu, CloseTab, CloseAllTabs, NextTab, PreviousTab


TTDIOption = ( tdiMiddleButtomClosePage, tdiRestoreLastActiveControl, tdiVerifyIfCanChangePage ) ;
TTDIOptions = set of TTDIOption ;\

tdiMiddleButtomClosePage - Close Page with Mouse middle button
tdiRestoreLastActiveControl - Restore the focus control to the Last focused component on Page, after change to a new Page
tdiVerifyIfCanChangePage - Try to fire OnExit event of current focused control on Page before leave it. If isn't possible to change to another control, doesn't change the Page


The HotKey to Close a Page, default is Ctrl+F4


Number of initial Pages that cannot be closed.


From the Free Pascal wiki, page "TTDINotebook", as it stood on 2019-09-19 after a change by Dopidaniel, 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.

Revision 1, last changed by WikiArchive .