diff --git a/components/tdi/Demo/TDIDemo.lps b/components/tdi/Demo/TDIDemo.lps index 8deb6d895..2ec759687 100644 --- a/components/tdi/Demo/TDIDemo.lps +++ b/components/tdi/Demo/TDIDemo.lps @@ -4,7 +4,7 @@ - + @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -34,9 +34,9 @@ - - - + + + @@ -50,8 +50,8 @@ - - + + @@ -64,20 +64,20 @@ - - - + + + - + - - - + + + @@ -93,24 +93,24 @@ - + - - - + + - - - + + + + @@ -121,7 +121,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -137,25 +137,17 @@ - + - + - - - - - - - - @@ -166,225 +158,219 @@ - + - - + + + - - - - - + + + + + + - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -393,91 +379,91 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -486,210 +472,261 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -697,123 +734,123 @@ - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - + - + - - + + - + diff --git a/components/tdi/Demo/umainform.lfm b/components/tdi/Demo/umainform.lfm index 715e9d70f..c64aefa65 100644 --- a/components/tdi/Demo/umainform.lfm +++ b/components/tdi/Demo/umainform.lfm @@ -92,6 +92,7 @@ object fMainForm: TfMainForm Lines.Strings = ( 'Memo1' ) + ScrollBars = ssAutoBoth TabOrder = 0 end end diff --git a/components/tdi/Demo/umainform.pas b/components/tdi/Demo/umainform.pas index cdf276f37..74f345a99 100644 --- a/components/tdi/Demo/umainform.pas +++ b/components/tdi/Demo/umainform.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, - ComCtrls, Buttons, StdCtrls, ExtCtrls, Spin, TDIClass, IpHtml; + ComCtrls, Buttons, StdCtrls, ExtCtrls, Spin, TDIClass; type @@ -78,6 +78,10 @@ begin Screen.OnActiveControlChange := @ShowNewControl; cbxBackgroundCorner.ItemIndex := Integer(TDINoteBook1.BackgroundCorner); + try + Memo1.Lines.LoadFromFile( ExtractFilePath(Application.ExeName)+'..'+PathDelim+'read-me.txt' ); + except + end; end; procedure TfMainForm.FormDestroy(Sender : TObject) ; diff --git a/components/tdi/read-me.txt b/components/tdi/read-me.txt index 2a7657710..a0db22770 100644 --- a/components/tdi/read-me.txt +++ b/components/tdi/read-me.txt @@ -1,10 +1,157 @@ -What is TDI ? -Please see: -http://en.wikipedia.org/wiki/Tab_%28GUI%29 +http://wiki.freepascal.org/tdi -This is a very alfa post... -I will write a Page on Wiki, and adjust all files for LGPL License +=== Contents === -Author: -Daniel Simões de Almeida -daniel@djsystem.com.br \ No newline at end of file + 1 About + 2 Author + 3 License + 4 Key Features + 5 Download + 6 Dependencies / System Requirements + 7 Screenshot + 8 Installation + 9 How to Use + 10 Methods and Properties + 11 Note + +=== 1 - About === + + A Tabbed GUI Interface + + 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: +http://en.wikipedia.org/wiki/Multiple_document_interface# +Comparison_with_single_document_interface + + 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 + + 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. + +=== 2 - Author === + +Author: Daniel Simões de Almeida +daniel@djsystem.com.br + +=== 3 - License === + +LGPL +http://www.opensource.org/licenses/lgpl-license.php + +=== 4 - Key Features === + +- Automatically takes care of Creation and Destruction of the tabs, +- Automatically takes care of Main Menu Items related to tabs +- Automatically Close the tabs when the Internal Form is Closed or Destroyed +- Allows you to display a background image in a corner of the Form +- Respects the Max Constraint of Internal Forms, centralizing it on the Tab +- Respects the Internal Forms OnCloseQuery event when closing a Tab +- Allows customization of Labels and Images of the Menu Items Tabs +- Allow to close Tabs with Mouse Middle Button +- Allows Close All Tabs + +=== 5 - Download === + + The package can be downloaded from the Lazarus CCR SVN repository. + https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/tdi + +You will need a SVN Client + + On Windows you can use TortoiseSVN: http://tortoisesvn.net/downloads.html + + On Linux, use: + svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/tdi + +=== 6 - Dependencies / System Requirements === + + None + +=== 7 - Screenshot === + +http://wiki.freepascal.org/tdi#Screenshot + +=== 8 - Installation === + +- Download the package on a directory of your preference +- Open Package File: tdi.lpk. +- Install the Package and let Lazarus rebuild. + +=== 9 - How to Use === + + Please open Project tdi\Demo\TDIDemo.lpi + I believe studying the sources and observing the Demo working is the best way +to explain the component + +=== 10 - Methods and Properties === + +* procedure ShowFormInPage( AForm: TForm; ImageIndex : Integer = -1 ); + 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. + +* procedure CreateFormInNewPage( AFormClass: TFormClass; ImageIndex : Integer = -1 ) ; + Create a New AFormClass, in a new Page. + ( Remember to assign CloseAction := caFree; on OnClose event of this Form) + +* Function CanCloseAPage( APageIndex: Integer): Boolean; + This will fire OnCloseQuery of the Internal Form reference to a APageIndex Tab, + and Returns True if it can be Closed. + +* Function FindFormInPages( AForm: TForm): Integer ; + Search an Page that owns AForm variable, returning the TabIndex if found or -1 + if doesn't. + +* Function CanCloseAllPages: Boolean; + The same as above, but will check All Tabs + +* procedure ScrollPage( ToForward: Boolean ); + Go to Next ou Prior Page, depending ToForward parameter + +* procedure CheckInterface; + Check the TDI Interface, enabling/disabling internal components (This method + is called from inside) + +* property BackgroundImage : TImage + +* property BackgroundCorner : TTDIBackgroundCorner + TTDIBackgroundCorner = (coTopLeft, coTopRight, coBottomLeft, coBottomRight); + +* property MainMenu : TMainMenu + If Assigned, TTDINotebook will use it to Create Menu Items for Tabs operations + (see Image1) + +* property CloseTabButtom : TTDICloseTabButtom + 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 + +* property TDIActions : TTDIActions + Allow to customize Label and Images of Menu Items for operations: + TabsMenu, CloseTab, CloseAllTabs, NextTab, PreviousTab + +* property TDIOptions : TTDIOptions + 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. + +* property ShortCutClosePage: TShortCut + The HotKey to Close a Page, default is Ctrl+F4 + +* property FixedPages : Integer + Number of initial Pages that cannot be closed. diff --git a/components/tdi/tdiclass.pas b/components/tdi/tdiclass.pas index a4d5dfbac..fa59e85ff 100644 --- a/components/tdi/tdiclass.pas +++ b/components/tdi/tdiclass.pas @@ -19,7 +19,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA You can also get a copy of the license accessing the address: - Http://www.opensource.org/licenses/gpl-license.php + http://www.opensource.org/licenses/lgpl-license.php Daniel Simões de Almeida - daniel@djsystem.com.br - www.djsystem.com.br Rua Coronel Aureliano de Camargo, 973 - Tatuí - SP - 18270-170 diff --git a/components/tdi/tdiconst.pas b/components/tdi/tdiconst.pas index d3e4a3fef..3554e24d2 100644 --- a/components/tdi/tdiconst.pas +++ b/components/tdi/tdiconst.pas @@ -19,7 +19,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA You can also get a copy of the license accessing the address: - Http://www.opensource.org/licenses/gpl-license.php + http://www.opensource.org/licenses/lgpl-license.php Daniel Simões de Almeida - daniel@djsystem.com.br - www.djsystem.com.br Rua Coronel Aureliano de Camargo, 973 - Tatuí - SP - 18270-170 diff --git a/components/tdi/tdireg.pas b/components/tdi/tdireg.pas index 174ec5d55..3bac4ace3 100644 --- a/components/tdi/tdireg.pas +++ b/components/tdi/tdireg.pas @@ -19,7 +19,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA You can also get a copy of the license accessing the address: - Http://www.opensource.org/licenses/gpl-license.php + http://www.opensource.org/licenses/lgpl-license.php Daniel Simões de Almeida - daniel@djsystem.com.br - www.djsystem.com.br Rua Coronel Aureliano de Camargo, 973 - Tatuí - SP - 18270-170