git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2400 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
dopi
2012-04-21 22:57:35 +00:00
parent f14005671f
commit 26f6b7f3af
8 changed files with 320 additions and 202 deletions

View File

@ -4,7 +4,7 @@
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="65">
<Units Count="73">
<Unit0>
<Filename Value="TDIDemo.lpr"/>
<IsPartOfProject Value="True"/>
@ -12,7 +12,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="36" Y="18"/>
<UsageCount Value="109"/>
<UsageCount Value="111"/>
</Unit0>
<Unit1>
<Filename Value="mainform.pas"/>
@ -23,7 +23,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="10" Y="8"/>
<UsageCount Value="109"/>
<UsageCount Value="111"/>
</Unit1>
<Unit2>
<Filename Value="uform1.pas"/>
@ -34,9 +34,9 @@
<UnitName Value="uForm1"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="53"/>
<CursorPos X="13" Y="60"/>
<UsageCount Value="109"/>
<TopLine Value="91"/>
<CursorPos X="44" Y="96"/>
<UsageCount Value="111"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit2>
@ -49,9 +49,9 @@
<UnitName Value="uForm2"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="46"/>
<CursorPos X="75" Y="62"/>
<UsageCount Value="31"/>
<TopLine Value="63"/>
<CursorPos X="57" Y="70"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit3>
@ -61,28 +61,28 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uMainForm"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="140"/>
<CursorPos X="14" Y="147"/>
<UsageCount Value="53"/>
<TopLine Value="10"/>
<CursorPos X="7" Y="14"/>
<UsageCount Value="54"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\tdiclass.pas"/>
<UnitName Value="TDIClass"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="679"/>
<CursorPos X="14" Y="684"/>
<UsageCount Value="53"/>
<TopLine Value="934"/>
<CursorPos X="3" Y="946"/>
<UsageCount Value="54"/>
<Bookmarks Count="4">
<Item0 X="17" Y="899" ID="3"/>
<Item1 X="1" Y="320" ID="2"/>
<Item2 X="23" Y="268" ID="1"/>
<Item3 X="45" Y="56" ID="5"/>
<Item0 X="17" Y="961" ID="3"/>
<Item1 X="1" Y="331" ID="2"/>
<Item2 X="45" Y="56" ID="5"/>
<Item3 X="12" Y="945" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit5>
@ -96,12 +96,10 @@
</Unit6>
<Unit7>
<Filename Value="C:\lazarus\lcl\include\customnotebook.inc"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="448"/>
<CursorPos X="3" Y="457"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="C:\lazarus\lcl\include\control.inc"/>
@ -186,12 +184,10 @@
<Unit17>
<Filename Value="C:\lazarus\lcl\controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/>
<TopLine Value="1585"/>
<CursorPos X="14" Y="1596"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit17>
<Unit18>
<Filename Value="C:\lazarus\lcl\graphics.pp"/>
@ -204,22 +200,18 @@
<Unit19>
<Filename Value="C:\lazarus\components\lazcontrols\extendednotebook.pas"/>
<UnitName Value="ExtendedNotebook"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="35"/>
<CursorPos X="3" Y="46"/>
<UsageCount Value="19"/>
<Loaded Value="True"/>
</Unit19>
<Unit20>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<UnitName Value="ComCtrls"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="424"/>
<CursorPos X="14" Y="432"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="C:\lazarus\lcl\include\pagecontrol.inc"/>
@ -425,12 +417,10 @@
</Unit46>
<Unit47>
<Filename Value="C:\lazarus\lcl\include\customform.inc"/>
<EditorIndex Value="9"/>
<WindowIndex Value="0"/>
<TopLine Value="2088"/>
<CursorPos X="17" Y="2070"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit47>
<Unit48>
<Filename Value="C:\lazarus\lcl\include\screen.inc"/>
@ -442,12 +432,10 @@
<Unit49>
<Filename Value="C:\lazarus\lcl\forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/>
<TopLine Value="687"/>
<CursorPos X="14" Y="698"/>
<UsageCount Value="19"/>
<Loaded Value="True"/>
</Unit49>
<Unit50>
<Filename Value="C:\lazarus\lcl\lclmessageglue.pas"/>
@ -516,8 +504,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="DJ_FormPrincipal"/>
<WindowIndex Value="0"/>
<TopLine Value="388"/>
<CursorPos X="1" Y="404"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="17"/>
</Unit58>
<Unit59>
@ -562,131 +550,164 @@
<CursorPos X="23" Y="228"/>
<UsageCount Value="10"/>
</Unit64>
<Unit65>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\comctrls.pp"/>
<UnitName Value="ComCtrls"/>
<WindowIndex Value="0"/>
<TopLine Value="546"/>
<CursorPos X="28" Y="561"/>
<UsageCount Value="11"/>
</Unit65>
<Unit66>
<Filename Value="..\..\..\..\..\dev\lazarus\components\lazcontrols\extendednotebook.pas"/>
<UnitName Value="ExtendedNotebook"/>
<WindowIndex Value="0"/>
<TopLine Value="50"/>
<CursorPos X="15" Y="79"/>
<UsageCount Value="10"/>
</Unit66>
<Unit67>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\controls.pp"/>
<UnitName Value="Controls"/>
<WindowIndex Value="0"/>
<TopLine Value="1891"/>
<CursorPos X="1" Y="2014"/>
<UsageCount Value="10"/>
</Unit67>
<Unit68>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\include\control.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="4176"/>
<CursorPos X="30" Y="4185"/>
<UsageCount Value="10"/>
</Unit68>
<Unit69>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\menus.pp"/>
<UnitName Value="Menus"/>
<WindowIndex Value="0"/>
<TopLine Value="267"/>
<CursorPos X="1" Y="287"/>
<UsageCount Value="10"/>
</Unit69>
<Unit70>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\include\menuitem.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1426"/>
<CursorPos X="3" Y="1435"/>
<UsageCount Value="10"/>
</Unit70>
<Unit71>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\forms.pp"/>
<UnitName Value="Forms"/>
<WindowIndex Value="0"/>
<TopLine Value="399"/>
<CursorPos X="14" Y="665"/>
<UsageCount Value="10"/>
</Unit71>
<Unit72>
<Filename Value="..\..\..\..\..\dev\lazarus\lcl\include\wincontrol.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="5527"/>
<CursorPos X="3" Y="5532"/>
<UsageCount Value="10"/>
</Unit72>
</Units>
<General>
<ActiveWindowIndexAtStart Value="0"/>
</General>
<JumpHistory Count="30" HistoryIndex="29">
<JumpHistory Count="23" HistoryIndex="22">
<Position1>
<Filename Value="uform2.pas"/>
<Caret Line="50" Column="15" TopLine="44"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="881" Column="1" TopLine="876"/>
</Position1>
<Position2>
<Filename Value="uform2.pas"/>
<Caret Line="51" Column="15" TopLine="45"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="919" Column="1" TopLine="911"/>
</Position2>
<Position3>
<Filename Value="uform1.pas"/>
<Caret Line="58" Column="15" TopLine="54"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="929" Column="1" TopLine="911"/>
</Position3>
<Position4>
<Filename Value="uform1.pas"/>
<Caret Line="61" Column="8" TopLine="51"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="919" Column="1" TopLine="911"/>
</Position4>
<Position5>
<Filename Value="uform1.pas"/>
<Caret Line="62" Column="8" TopLine="52"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="921" Column="1" TopLine="911"/>
</Position5>
<Position6>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="374" Column="42" TopLine="362"/>
<Caret Line="922" Column="45" TopLine="911"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="76" Column="29" TopLine="71"/>
<Caret Line="147" Column="9" TopLine="129"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="137" Column="3" TopLine="134"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="158" Column="34" TopLine="138"/>
</Position8>
<Position9>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="376" Column="23" TopLine="362"/>
<Filename Value="umainform.pas"/>
<Caret Line="27" Column="17" TopLine="22"/>
</Position9>
<Position10>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="696" Column="8" TopLine="693"/>
<Filename Value="uform2.pas"/>
<Caret Line="63" Column="75" TopLine="47"/>
</Position10>
<Position11>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="695" Column="1" TopLine="691"/>
<Filename Value="uform1.pas"/>
<Caret Line="62" Column="23" TopLine="54"/>
</Position11>
<Position12>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="696" Column="30" TopLine="691"/>
<Filename Value="uform2.pas"/>
<Caret Line="74" Column="28" TopLine="64"/>
</Position12>
<Position13>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="104" Column="24" TopLine="93"/>
<Filename Value="umainform.pas"/>
<Caret Line="87" Column="17" TopLine="78"/>
</Position13>
<Position14>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="106" Column="15" TopLine="65"/>
<Caret Line="130" Column="67" TopLine="116"/>
</Position14>
<Position15>
<Filename Value="C:\lazarus\components\lazcontrols\extendednotebook.pas"/>
<Caret Line="46" Column="3" TopLine="35"/>
<Filename Value="umainform.pas"/>
<Caret Line="14" Column="7" TopLine="10"/>
</Position15>
<Position16>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="505" Column="3" TopLine="494"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="945" Column="15" TopLine="936"/>
</Position16>
<Position17>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="569" Column="21" TopLine="553"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position17>
<Position18>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="126" Column="63" TopLine="110"/>
<Caret Line="945" Column="14" TopLine="927"/>
</Position18>
<Position19>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="428" Column="32" TopLine="417"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position19>
<Position20>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="432" Column="69" TopLine="417"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="10" Column="36" TopLine="1"/>
</Position20>
<Position21>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="433" Column="70" TopLine="417"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="112" Column="17" TopLine="94"/>
</Position21>
<Position22>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<Caret Line="569" Column="30" TopLine="550"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="130" Column="50" TopLine="111"/>
</Position22>
<Position23>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="374" Column="27" TopLine="322"/>
<Caret Line="255" Column="29" TopLine="245"/>
</Position23>
<Position24>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position24>
<Position25>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="113" Column="30" TopLine="102"/>
</Position25>
<Position26>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="374" Column="1" TopLine="359"/>
</Position26>
<Position27>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="421" Column="33" TopLine="402"/>
</Position27>
<Position28>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="462" Column="37" TopLine="443"/>
</Position28>
<Position29>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="508" Column="35" TopLine="495"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="146" Column="14" TopLine="139"/>
</Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -11,15 +11,18 @@ object Form1: TForm1
Constraints.MaxWidth = 500
Constraints.MinHeight = 200
Constraints.MinWidth = 300
Font.Height = -12
KeyPreview = True
OnClose = FormClose
OnCloseQuery = FormCloseQuery
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
LCLVersion = '1.1'
object bClose: TButton
Left = 392
Height = 25
Height = 27
Top = 216
Width = 86
Width = 70
AutoSize = True
Caption = 'Close Form'
OnClick = bCloseClick
@ -27,7 +30,7 @@ object Form1: TForm1
end
object Edit1: TEdit
Left = 24
Height = 23
Height = 25
Top = 62
Width = 82
TabOrder = 0
@ -35,7 +38,7 @@ object Form1: TForm1
end
object Edit2: TEdit
Left = 24
Height = 23
Height = 25
Top = 104
Width = 82
OnExit = Edit2Exit
@ -51,10 +54,10 @@ object Form1: TForm1
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 98
Height = 31
Left = 74
Height = 39
Top = 16
Width = 305
Width = 353
Alignment = taCenter
Caption = 'This Form has Max Constraints.'#13#10'It will be centralized on Tab Sheet if it is smaller than it'
Font.Style = [fsBold]
@ -65,9 +68,9 @@ object Form1: TForm1
AnchorSideTop.Control = bClose
AnchorSideTop.Side = asrCenter
Left = 32
Height = 46
Top = 205
Width = 324
Height = 52
Top = 203
Width = 323
Caption = 'You can Close or Hide your Forms the same way you used to.'#13#10'No Special method is necessary. TDINotebook will detect by '#13#10'internal Notification and Close the Tab Sheet'
ParentColor = False
end
@ -75,9 +78,9 @@ object Form1: TForm1
AnchorSideLeft.Control = bClose
AnchorSideLeft.Side = asrCenter
Left = 394
Height = 25
Height = 27
Top = 159
Width = 82
Width = 66
AutoSize = True
Caption = 'Hide Form'
OnClick = bHideClick
@ -87,9 +90,9 @@ object Form1: TForm1
AnchorSideTop.Control = bHide
AnchorSideTop.Side = asrCenter
Left = 16
Height = 16
Height = 18
Top = 163
Width = 364
Width = 409
Caption = 'But, If you Hide the Form, is better you have a way to Show it again :)'
Font.Color = clRed
ParentColor = False
@ -101,7 +104,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter
Left = 120
Height = 16
Top = 65
Top = 66
Width = 106
Caption = 'This is a regular Edit'
ParentColor = False
@ -110,9 +113,9 @@ object Form1: TForm1
AnchorSideTop.Control = Edit2
AnchorSideTop.Side = asrCenter
Left = 120
Height = 46
Top = 92
Width = 347
Height = 52
Top = 90
Width = 344
Caption = 'This Edit has a OnExit Validation, who doesn''t allow Page Change'#13#10' if this Edit is empty, and the focus is on it... '#13#10'This can be disabled changing the property "VerifyIfCanChange"'
ParentColor = False
end
@ -121,10 +124,10 @@ object Form1: TForm1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = bClose
Left = 379
Left = 371
Height = 16
Top = 194
Width = 112
Width = 113
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 6
Caption = 'This Form use caFree'
@ -134,10 +137,10 @@ object Form1: TForm1
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Side = asrCenter
Left = 35
Left = 33
Height = 16
Top = 264
Width = 431
Width = 434
Caption = 'This Form demonstrate that TDINotebook respects your OnCloseQuery Validation'
ParentColor = False
end

View File

@ -32,6 +32,7 @@ type
procedure FormClose(Sender : TObject ; var CloseAction : TCloseAction) ;
procedure FormCloseQuery(Sender : TObject ; var CanClose : boolean) ;
procedure FormDestroy(Sender : TObject) ;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure tShowmeAgainTimer(Sender : TObject) ;
private
{ private declarations }
@ -95,6 +96,12 @@ begin
fMainForm.mEvents.Lines.Add( 'Form1.Destroy' );
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
);
begin
fMainForm.mEvents.Lines.Add( 'Form1.KeyDown' );
end;
procedure TForm1.tShowmeAgainTimer(Sender : TObject) ;
begin
tShowmeAgain.Enabled := False;

View File

@ -2,55 +2,57 @@ object Form2: TForm2
Left = 564
Height = 252
Top = 330
Width = 452
Width = 499
Caption = 'Form2'
ClientHeight = 252
ClientWidth = 452
ClientWidth = 499
KeyPreview = True
OnClose = FormClose
OnCloseQuery = FormCloseQuery
OnDestroy = FormDestroy
OnHide = FormHide
OnKeyDown = FormKeyDown
OnShow = FormShow
LCLVersion = '1.1'
object Edit1: TEdit
Left = 48
Height = 23
Height = 27
Top = 80
Width = 356
Width = 403
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
Text = 'Edit1'
end
object Edit2: TEdit
Left = 48
Height = 23
Height = 27
Top = 120
Width = 356
Width = 403
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
Text = 'Edit2'
end
object CheckBox1: TCheckBox
Left = 48
Height = 19
Height = 21
Top = 152
Width = 78
Width = 89
Caption = 'CheckBox1'
TabOrder = 2
end
object CheckBox2: TCheckBox
Left = 48
Height = 19
Height = 21
Top = 184
Width = 78
Width = 89
Caption = 'CheckBox2'
TabOrder = 3
end
object bClose: TButton
Left = 318
Height = 25
Top = 192
Width = 86
Left = 374
Height = 29
Top = 188
Width = 77
Anchors = [akRight, akBottom]
AutoSize = True
Caption = 'Close Form'
@ -60,10 +62,10 @@ object Form2: TForm2
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 21
Height = 31
Left = 12
Height = 39
Top = 16
Width = 411
Width = 474
Alignment = taCenter
Caption = 'This Form does NOT have Max Constraints. It will be Aligned by "alClient". '#13#10'Design forms like this using Anchors to expand controls all over the Page'
Font.Style = [fsBold]
@ -75,10 +77,10 @@ object Form2: TForm2
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = bClose
AnchorSideTop.Side = asrBottom
Left = 302
Height = 16
Left = 346
Height = 18
Top = 223
Width = 118
Width = 133
BorderSpacing.Top = 6
Caption = 'This Form is not Freed'
ParentColor = False

View File

@ -25,6 +25,7 @@ type
procedure FormCloseQuery(Sender : TObject ; var CanClose : boolean) ;
procedure FormDestroy(Sender : TObject) ;
procedure FormHide(Sender : TObject) ;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender : TObject) ;
private
{ private declarations }
@ -67,6 +68,12 @@ begin
fMainForm.mEvents.Lines.Add( 'Form2.Hide' );
end;
procedure TForm2.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
);
begin
fMainForm.mEvents.Lines.Add( 'Form2.FormKeyDown');
end;
procedure TForm2.FormShow(Sender : TObject) ;
begin
fMainForm.mEvents.Lines.Add( 'Form2.Show' );

View File

@ -1,22 +1,24 @@
object fMainForm: TfMainForm
Left = 471
Left = 374
Height = 484
Top = 200
Width = 746
Top = 155
Width = 799
Caption = 'fMainForm'
ClientHeight = 464
ClientWidth = 746
ClientHeight = 461
ClientWidth = 799
KeyPreview = True
Menu = MainMenu1
OnClose = FormClose
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
LCLVersion = '1.1'
object StatusBar1: TStatusBar
Left = 0
Height = 23
Top = 441
Width = 746
Height = 17
Top = 444
Width = 799
Panels = <
item
Text = 'Active Control'
@ -29,9 +31,9 @@ object fMainForm: TfMainForm
end
object TDINoteBook1: TTDINoteBook
Left = 0
Height = 391
Height = 394
Top = 0
Width = 587
Width = 579
ActivePage = tsFixed
Align = alClient
Constraints.MinHeight = 300
@ -42,6 +44,7 @@ object fMainForm: TfMainForm
TabOrder = 1
OnChange = TDINoteBook1Change
OnCloseTabClicked = TDINoteBook1CloseTabClicked
OnMouseDown = TDINoteBook1MouseDown
Options = [nboShowCloseButtons, nboMultiLine, nboKeyboardTabSwitch, nboShowAddTabButton]
TabDragMode = dmAutomatic
TabDragAcceptMode = dmAutomatic
@ -53,28 +56,29 @@ object fMainForm: TfMainForm
TDIActions.CloseTab.ImageIndex = 1
TDIActions.CloseAllTabs.Caption = 'Close All Tabs'
TDIActions.CloseAllTabs.ImageIndex = 2
ClosePageShortCut = 16499
FixedPages = 1
object tsFixed: TTabSheet
Caption = 'TTDINotebook Demo'
ClientHeight = 363
ClientWidth = 579
ClientHeight = 364
ClientWidth = 577
ImageIndex = 5
object Label2: TLabel
AnchorSideLeft.Control = tsFixed
AnchorSideLeft.Side = asrCenter
Left = 167
Height = 31
Left = 152
Height = 39
Top = 312
Width = 244
Width = 272
Alignment = taCenter
Caption = 'This is a Fixed Page, and cannot be closed.'#13#10'You can configure it on "FixedPages" Property'
ParentColor = False
end
object IpHtmlPanel1: TIpHtmlPanel
Left = 0
Height = 290
Height = 267
Top = 0
Width = 579
Width = 577
Align = alTop
FixedTypeface = 'Courier New'
DefaultTypeFace = 'default'
@ -87,25 +91,22 @@ object fMainForm: TfMainForm
TabOrder = 0
end
end
object TabSheet1: TTabSheet
Caption = 'TabSheet1'
end
end
object pBottom: TPanel
Left = 0
Height = 50
Top = 391
Width = 746
Top = 394
Width = 799
Align = alBottom
ClientHeight = 50
ClientWidth = 746
ClientWidth = 799
TabOrder = 2
object cbxBackgroundCorner: TComboBox
Left = 21
Height = 23
Height = 31
Top = 18
Width = 115
ItemHeight = 15
ItemHeight = 0
Items.Strings = (
'coTopLeft'
'coTopRight'
@ -118,19 +119,19 @@ object fMainForm: TfMainForm
end
object Label1: TLabel
Left = 22
Height = 16
Height = 18
Top = 1
Width = 101
Width = 114
Caption = 'BackgroundCorner'
ParentColor = False
end
object bToggleLog: TButton
AnchorSideTop.Control = pBottom
AnchorSideTop.Side = asrCenter
Left = 622
Height = 25
Top = 13
Width = 85
Left = 688
Height = 29
Top = 11
Width = 72
Anchors = [akTop, akRight]
AutoSize = True
Caption = 'Hide Log >'
@ -139,15 +140,15 @@ object fMainForm: TfMainForm
end
object Label3: TLabel
Left = 182
Height = 16
Height = 18
Top = 1
Width = 59
Width = 68
Caption = 'FixedPages'
ParentColor = False
end
object seFixedPages: TSpinEdit
Left = 184
Height = 23
Height = 27
Top = 17
Width = 50
MaxValue = 10
@ -157,19 +158,20 @@ object fMainForm: TfMainForm
end
end
object mEvents: TMemo
Left = 592
Height = 391
Left = 584
Height = 394
Top = 0
Width = 154
Width = 215
Align = alRight
Lines.Strings = (
'Events Log'
)
ScrollBars = ssAutoBoth
TabOrder = 4
end
object Splitter1: TSplitter
Left = 587
Height = 391
Left = 579
Height = 394
Top = 0
Width = 5
Align = alRight
@ -178,9 +180,9 @@ object fMainForm: TfMainForm
object Image1: TImage
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 485
Left = 538
Height = 94
Top = 269
Top = 266
Width = 94
Anchors = [akRight, akBottom]
AutoSize = True

View File

@ -33,7 +33,6 @@ type
seFixedPages : TSpinEdit ;
Splitter1 : TSplitter ;
StatusBar1 : TStatusBar ;
TabSheet1 : TTabSheet ;
tsFixed : TTabSheet ;
TDINoteBook1 : TTDINoteBook ;
procedure bToggleLogClick(Sender : TObject) ;
@ -42,6 +41,7 @@ type
procedure FormCloseQuery(Sender : TObject ; var CanClose : boolean) ;
procedure FormCreate(Sender : TObject) ;
procedure FormDestroy(Sender : TObject) ;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure MenuItem3Click(Sender : TObject) ;
procedure miExitClick(Sender : TObject) ;
procedure miForm1Click(Sender : TObject) ;
@ -49,6 +49,8 @@ type
procedure seFixedPagesChange(Sender : TObject) ;
procedure TDINoteBook1Change(Sender : TObject) ;
procedure TDINoteBook1CloseTabClicked(Sender : TObject) ;
procedure TDINoteBook1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ private declarations }
Procedure ShowNewControl(Sender: TObject);
@ -81,6 +83,12 @@ begin
mEvents.Lines.Add('fMainForm.Destroy');
end;
procedure TfMainForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
mEvents.Lines.Add('fMainForm.FormKeyDown');
end;
procedure TfMainForm.MenuItem3Click(Sender : TObject) ;
begin
Form2.Show;
@ -143,6 +151,12 @@ begin
mEvents.Lines.Add( 'TDINoteBook1.OnCloseTabClicked' );
end;
procedure TfMainForm.TDINoteBook1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
mEvents.Lines.Add( 'TDINoteBook1.OnMouseDown' );
end;
procedure TfMainForm.ShowNewControl(Sender : TObject) ;
var
ControlCaption : String ;

View File

@ -85,6 +85,8 @@ type
FMainMenu : TMainMenu ;
FBackgroundCorner : TTDIBackgroundCorner ;
FTDIActions : TTDIActions ;
FClosePageShortCut: TShortCut;
FClosePageMouseMiddleButtom: Boolean;
procedure SetBackgroundImage(AValue : TImage) ;
procedure SetBackgroundCorner(AValue : TTDIBackgroundCorner) ;
@ -124,11 +126,15 @@ type
procedure Loaded; override;
procedure RemovePage(Index: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(TheOwner: TComponent ); override;
constructor Create(TheOwner: TComponent); override;
destructor Destroy ; override;
procedure DoCloseTabClicked(APage: TCustomPage); override;
procedure CreateFormInNewPage( AFormClass: TFormClass; ImageIndex : Integer = -1 ) ;
procedure ShowForInNewPage( AForm: TForm; ImageIndex : Integer = -1 );
@ -149,6 +155,11 @@ type
property TDIActions : TTDIActions read FTDIActions write FTDIActions ;
property ClosePageMouseMiddleButtom : Boolean read FClosePageMouseMiddleButtom
write FClosePageMouseMiddleButtom default True;
property ClosePageShortCut: TShortCut read FClosePageShortCut
write FClosePageShortCut default 0;
property RestoreActiveControl : Boolean read FRestoreActiveControl
write FRestoreActiveControl default True;
property VerifyIfCanChangePage : Boolean read FVerifyIfCanChangePage
@ -363,6 +374,8 @@ begin
FRestoreActiveControl := True;
FVerifyIfCanChangePage := True;
FIsRemovingAPage := False;
FClosePageMouseMiddleButtom:= True;
FClosePageShortCut := 0;
FBackgroundImage := nil;
FCloseBitBtn := nil;
FCloseMenuItem := nil;
@ -404,6 +417,23 @@ begin
inherited Destroy;
end ;
procedure TTDINoteBook.DoCloseTabClicked(APage: TCustomPage);
var
LastPageCount: Integer;
begin
LastPageCount := PageCount;
inherited DoCloseTabClicked(APage);
if Assigned( APage ) and (LastPageCount = PageCount) then // If Page was not closed...
begin
PageIndex := APage.PageIndex;
if PageIndex >= FixedPages then
RemovePage( APage.PageIndex );
end;
end;
procedure TTDINoteBook.CreateCloseBitBtn ;
begin
if FCloseBitBtn <> nil then exit;
@ -892,6 +922,38 @@ begin
end ;
end ;
procedure TTDINoteBook.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
var
APageIndex : Integer ;
begin
if FClosePageMouseMiddleButtom and (Button = mbMiddle) then
begin
APageIndex := TabIndexAtClientPos( Point(X,Y) );
if (APageIndex >= 0) and (APageIndex >= FixedPages) then
begin
RemovePage( APageIndex );
exit;
end;
end;
inherited MouseDown(Button, Shift, X, Y);
end;
procedure TTDINoteBook.KeyDown(var Key: Word; Shift: TShiftState);
begin
// TODO: HiJack TDIPage.Form.OnKeyDown to detect ShortCut inside the Form //
if ShortCut(Key, Shift) = FClosePageShortCut then
if PageIndex >= FFixedPages then
begin
RemovePage( PageIndex );
exit;
end;
inherited KeyDown(Key, Shift);
end;
procedure TTDINoteBook.Notification(AComponent : TComponent ;
Operation : TOperation) ;
begin