TTDINotebook: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TTDINotebook
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **TTDINotebook** is a component that provides a **Tabbed Document Interface (TDI)**. | |
| 2 | + | ||
| 3 | + | Lazarus does not have full support for MDI interface yet, and commercial applications need to open several windows at once without ShowModal. | |
| 4 | + | ||
| 5 | + | 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](http://en.wikipedia.org/wiki/Multiple_document_interface#Comparison_with_single_document_interface). | |
| 6 | + | ||
| 7 | + | The intention of this component is to provide a simple way to create an TDI interface, similar to that [described in Wikipedia](http://en.wikipedia.org/wiki/Tabbed_document_interface). | |
| 8 | + | ||
| 9 | + | 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. | |
| 10 | + | ||
| 11 | + | Author | |
| 12 | + | Daniel Simões de Almeida - daniel @ projetoacbr.com.br | |
| 13 | + | ||
| 14 | + | License | |
| 15 | + | [LGPL](http://www.opensource.org/licenses/lgpl-license.php) | |
| 16 | + | ||
| 17 | + | ## Key Features | |
| 18 | + | ||
| 19 | + | - Automatically takes care of creation and destruction of the tabs, | |
| 20 | + | - Automatically takes care of main menu items related to tabs | |
| 21 | + | - Automatically close the tabs when the Internal Form is Closed or Destroyed | |
| 22 | + | - Allows you to display a background image in a corner of the Form | |
| 23 | + | - Respects the *Max Constraint* of Internal Forms, centralizing it on the Tab | |
| 24 | + | - Respects the Internal Forms *OnCloseQuery* event when closing a Tab | |
| 25 | + | - Allows customization of Labels and Images of the Menu Items Tabs | |
| 26 | + | - Allow to close Tabs with Mouse Middle Button | |
| 27 | + | - Allows Close All Tabs | |
| 28 | + | ||
| 29 | + | ## Download | |
| 30 | + | ||
| 31 | + | - The package can be downloaded from the [Lazarus CCR SVN repository](https://svn.code.sf.net/p/lazarus-ccr/svn/components/tdi/). | |
| 32 | + | - You will need a SVN Client: | |
| 33 | + | - On Windows you can use [TortoiseSVN](http://tortoisesvn.net/downloads.html) | |
| 34 | + | - On Linux, use: svn co <https://svn.code.sf.net/p/lazarus-ccr/svn/components/tdi/> | |
| 35 | + | ||
| 36 | + | ## Dependencies / System Requirements | |
| 37 | + | ||
| 38 | + | - None | |
| 39 | + | ||
| 40 | + | ## Screenshot | |
| 41 | + | ||
| 42 | + | -  | |
| 43 | + | ||
| 44 | + | *  | |
| 45 | + | ||
| 46 | + | ## Installation | |
| 47 | + | ||
| 48 | + | - Download the package on a directory of your preference | |
| 49 | + | - Open Package File: **tdi.lpk**. | |
| 50 | + | - Install the Package and let Lazarus rebuild. | |
| 51 | + | ||
| 52 | + | ## How to Use | |
| 53 | + | ||
| 54 | + | - Please open Project **tdi\Demo\TDIDemo.lpi** | |
| 55 | + | - I believe studying the sources and observing the Demo working is the best way to explain the component | |
| 56 | + | ||
| 57 | + | ## Methods and Properties | |
| 58 | + | ||
| 59 | + | - **procedure ShowFormInPage( AForm: TForm; ImageIndex : Integer = -1 );** | |
| 60 | + | ||
| 61 | + | 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. | |
| 62 | + | ||
| 63 | + | ------------------------------------------------------------------------ | |
| 64 | + | ||
| 65 | + | - **procedure CreateFormInNewPage( AFormClass: TFormClass; ImageIndex : Integer = -1 ) ;** | |
| 66 | + | ||
| 67 | + | Create a New *AFormClass*, in a new Page. ( Remember to assign CloseAction := caFree; on OnClose event of this Form) | |
| 68 | + | ||
| 69 | + | ------------------------------------------------------------------------ | |
| 70 | + | ||
| 71 | + | - **Function CanCloseAPage( APageIndex: Integer): Boolean;** | |
| 72 | + | ||
| 73 | + | This will fire *OnCloseQuery* of the Internal Form reference to a APageIndex Tab, and Returns True if it can be Closed. | |
| 74 | + | ||
| 75 | + | ------------------------------------------------------------------------ | |
| 76 | + | ||
| 77 | + | - **Function FindFormInPages( AForm: TForm): Integer ;** | |
| 78 | + | ||
| 79 | + | Search an Page that owns AForm variable, returning the TabIndex if found or -1 if doesn't. | |
| 80 | + | ||
| 81 | + | ------------------------------------------------------------------------ | |
| 82 | + | ||
| 83 | + | - **Function CanCloseAllPages: Boolean;** | |
| 84 | + | ||
| 85 | + | The same as above, but will check All Tabs | |
| 86 | + | ||
| 87 | + | ------------------------------------------------------------------------ | |
| 88 | + | ||
| 89 | + | - **procedure ScrollPage( ToForward: Boolean );** | |
| 90 | + | ||
| 91 | + | Go to Next ou Prior Page, depending ToForward parameter | |
| 92 | + | ||
| 93 | + | ------------------------------------------------------------------------ | |
| 94 | + | ||
| 95 | + | - **procedure CheckInterface;** | |
| 96 | + | ||
| 97 | + | Check the TDI Interface, enabling/disabling internal components (This method is called from inside) | |
| 98 | + | ||
| 99 | + | ------------------------------------------------------------------------ | |
| 100 | + | ||
| 101 | + | - **property BackgroundImage : TImage** | |
| 102 | + | ||
| 103 | + | ------------------------------------------------------------------------ | |
| 104 | + | ||
| 105 | + | - **property BackgroundCorner : TTDIBackgroundCorner** | |
| 106 | + | ||
| 107 | + | TTDIBackgroundCorner = (coTopLeft, coTopRight, coBottomLeft, coBottomRight); | |
| 108 | + | ||
| 109 | + | ------------------------------------------------------------------------ | |
| 110 | + | ||
| 111 | + | - **property MainMenu : TMainMenu** | |
| 112 | + | ||
| 113 | + | If Assigned, TTDINotebook will use it to Create Menu Items for Tabs operations (see Image1) | |
| 114 | + | ||
| 115 | + | ------------------------------------------------------------------------ | |
| 116 | + | ||
| 117 | + | - **property CloseTabButtom : TTDICloseTabButtom** | |
| 118 | + | ||
| 119 | + | TTDICloseTabButtom = (tbNone, tbMenu, tbButtom ) ;\ | |
| 120 | + | **tbNone** - None Close Button is showed\ | |
| 121 | + | **tbMenu** - Use MainMenu, to draw a Close Button aligned to Right (see Image1)\ | |
| 122 | + | **tbButtom** - Draw a small BitButtom, on Right Up corner of TTDINotebook | |
| 123 | + | ||
| 124 | + | ------------------------------------------------------------------------ | |
| 125 | + | ||
| 126 | + | - **property TDIActions : TTDIActions** | |
| 127 | + | ||
| 128 | + | Allow to customize Label and Images of Menu Items for operations:\ | |
| 129 | + | TabsMenu, CloseTab, CloseAllTabs, NextTab, PreviousTab | |
| 130 | + | ||
| 131 | + | ------------------------------------------------------------------------ | |
| 132 | + | ||
| 133 | + | - **property TDIOptions : TTDIOptions** | |
| 134 | + | ||
| 135 | + | TTDIOption = ( tdiMiddleButtomClosePage, tdiRestoreLastActiveControl, tdiVerifyIfCanChangePage ) ;\ | |
| 136 | + | TTDIOptions = set of TTDIOption ;\ | |
| 137 | + | ||
| 138 | + | **tdiMiddleButtomClosePage** - Close Page with Mouse middle button\ | |
| 139 | + | **tdiRestoreLastActiveControl** - Restore the focus control to the Last focused component on Page, after change to a new Page\ | |
| 140 | + | **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 | |
| 141 | + | ||
| 142 | + | ------------------------------------------------------------------------ | |
| 143 | + | ||
| 144 | + | - **property ShortCutClosePage: TShortCut** | |
| 145 | + | ||
| 146 | + | The HotKey to Close a Page, default is **Ctrl+F4** | |
| 147 | + | ||
| 148 | + | ------------------------------------------------------------------------ | |
| 149 | + | ||
| 150 | + | - **property FixedPages : Integer** | |
| 151 | + | ||
| 152 | + | Number of initial Pages that cannot be closed. | |
| 153 | + | ||
| 154 | + | --- | |
| 155 | + | *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](/wiki-contact).* | |
| 156 | + | Category: Components | |
| 157 | + | Category: Lazarus-CCR |
