-- TDINoteBook --

[+] Added new Option "tdiEmulateFormOnActivate". If Seted, will fire Internal Form
    OnActivate and OnDeactivate when changing Pages
    (by: DSA)
- Demo and OPM updated

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6786 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
dopi
2019-01-09 18:39:51 +00:00
parent d0105dfcd2
commit 873b9142bd
8 changed files with 163 additions and 122 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
@ -22,13 +22,12 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>

View File

@ -2,9 +2,9 @@
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="77">
<Units Count="79">
<Unit0>
<Filename Value="TDIDemo.lpr"/>
<IsPartOfProject Value="True"/>
@ -29,8 +29,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="uForm1"/>
<EditorIndex Value="1"/>
<TopLine Value="92"/>
<CursorPos X="107" Y="107"/>
<TopLine Value="73"/>
<CursorPos X="74" Y="92"/>
<UsageCount Value="209"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -45,7 +45,7 @@
<EditorIndex Value="2"/>
<TopLine Value="26"/>
<CursorPos X="19" Y="86"/>
<UsageCount Value="176"/>
<UsageCount Value="179"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit3>
@ -55,8 +55,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uMainForm"/>
<TopLine Value="17"/>
<CursorPos X="72" Y="37"/>
<IsVisibleTab Value="True"/>
<TopLine Value="91"/>
<CursorPos X="112" Y="105"/>
<UsageCount Value="101"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -65,8 +66,8 @@
<Filename Value="..\tdiclass.pas"/>
<UnitName Value="TDIClass"/>
<EditorIndex Value="3"/>
<TopLine Value="1181"/>
<CursorPos X="35" Y="1185"/>
<TopLine Value="1046"/>
<CursorPos X="38" Y="1060"/>
<UsageCount Value="101"/>
<Bookmarks Count="7">
<Item0 Y="348" ID="2"/>
@ -74,18 +75,17 @@
<Item2 X="3" Y="282" ID="6"/>
<Item3 X="3" Y="362" ID="5"/>
<Item4 X="17" Y="311" ID="7"/>
<Item5 X="5" Y="1067" ID="1"/>
<Item5 X="7" Y="1067" ID="1"/>
<Item6 X="40" Y="892" ID="3"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="C:\lazarus\lcl\include\customnotebook.inc"/>
<EditorIndex Value="5"/>
<EditorIndex Value="-1"/>
<TopLine Value="824"/>
<CursorPos X="3" Y="829"/>
<UsageCount Value="41"/>
<Loaded Value="True"/>
<UsageCount Value="42"/>
</Unit6>
<Unit7>
<Filename Value="C:\lazarus\lcl\include\control.inc"/>
@ -137,11 +137,10 @@
<Unit13>
<Filename Value="C:\lazarus\lcl\controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="7"/>
<EditorIndex Value="-1"/>
<TopLine Value="1598"/>
<CursorPos X="14" Y="1610"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
<UsageCount Value="23"/>
</Unit13>
<Unit14>
<Filename Value="C:\lazarus\components\lazcontrols\extendednotebook.pas"/>
@ -153,11 +152,10 @@
<Unit15>
<Filename Value="C:\lazarus\lcl\comctrls.pp"/>
<UnitName Value="ComCtrls"/>
<EditorIndex Value="4"/>
<TopLine Value="481"/>
<CursorPos X="14" Y="497"/>
<EditorIndex Value="-1"/>
<TopLine Value="648"/>
<CursorPos X="14" Y="667"/>
<UsageCount Value="41"/>
<Loaded Value="True"/>
</Unit15>
<Unit16>
<Filename Value="C:\lazarus\lcl\include\pagecontrol.inc"/>
@ -326,11 +324,10 @@
<Unit41>
<Filename Value="C:\lazarus\lcl\forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="6"/>
<EditorIndex Value="-1"/>
<TopLine Value="623"/>
<CursorPos X="14" Y="634"/>
<UsageCount Value="43"/>
<Loaded Value="True"/>
<UsageCount Value="44"/>
</Unit41>
<Unit42>
<Filename Value="C:\lazarus\lcl\lclmessageglue.pas"/>
@ -498,10 +495,10 @@
</Unit67>
<Unit68>
<Filename Value="..\read-me.txt"/>
<EditorIndex Value="8"/>
<TopLine Value="162"/>
<CursorPos X="56" Y="184"/>
<UsageCount Value="43"/>
<EditorIndex Value="6"/>
<TopLine Value="151"/>
<CursorPos X="64" Y="173"/>
<UsageCount Value="45"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="None"/>
</Unit68>
@ -546,11 +543,10 @@
</Unit74>
<Unit75>
<Filename Value="..\..\..\..\..\..\Comp\ACBr\trunk2\Fontes\ACBrComum\ACBrUtil.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="9"/>
<EditorIndex Value="7"/>
<TopLine Value="3067"/>
<CursorPos X="32" Y="3081"/>
<UsageCount Value="21"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit75>
<Unit76>
@ -561,125 +557,145 @@
<CursorPos X="78" Y="1181"/>
<UsageCount Value="10"/>
</Unit76>
<Unit77>
<Filename Value="C:\lazarus\lcl\lclversion.pas"/>
<UnitName Value="LCLVersion"/>
<EditorIndex Value="4"/>
<TopLine Value="23"/>
<CursorPos X="17" Y="40"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit77>
<Unit78>
<Filename Value="C:\lazarus\components\lazutils\lazversion.pas"/>
<UnitName Value="LazVersion"/>
<EditorIndex Value="5"/>
<CursorPos X="3" Y="23"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit78>
</Units>
<JumpHistory Count="29" HistoryIndex="28">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1153" Column="49" TopLine="1133"/>
</Position1>
<Position2>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1154" Column="7" TopLine="1134"/>
<Caret Line="164" Column="36" TopLine="134"/>
</Position2>
<Position3>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1155" TopLine="1134"/>
<Caret Line="470" Column="27" TopLine="439"/>
</Position3>
<Position4>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1163" TopLine="1136"/>
<Caret Line="493" Column="27" TopLine="462"/>
</Position4>
<Position5>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1155" TopLine="1136"/>
<Caret Line="898" Column="49" TopLine="871"/>
</Position5>
<Position6>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1160" TopLine="1136"/>
</Position6>
<Position7>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1161" TopLine="1136"/>
<Caret Line="110" Column="40" TopLine="79"/>
</Position7>
<Position8>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1150" Column="28" TopLine="1136"/>
<Caret Line="195" Column="40" TopLine="165"/>
</Position8>
<Position9>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1159" TopLine="1137"/>
<Caret Line="286" Column="45" TopLine="264"/>
</Position9>
<Position10>
<Filename Value="..\..\..\..\..\..\Comp\ACBr\trunk2\Fontes\ACBrComum\ACBrUtil.pas"/>
<Caret Line="19" Column="102"/>
<Filename Value="..\tdiclass.pas"/>
</Position10>
<Position11>
<Filename Value="..\read-me.txt"/>
<Caret Column="40"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="110" Column="40" TopLine="79"/>
</Position11>
<Position12>
<Filename Value="..\read-me.txt"/>
<Caret Line="30" Column="78"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="195" Column="40" TopLine="165"/>
</Position12>
<Position13>
<Filename Value="..\read-me.txt"/>
<Caret Line="35" Column="38" TopLine="5"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="286" Column="45" TopLine="255"/>
</Position13>
<Position14>
<Filename Value="..\read-me.txt"/>
<Caret Column="5"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="898" Column="49" TopLine="867"/>
</Position14>
<Position15>
<Filename Value="..\read-me.txt"/>
<Caret Line="27" Column="58"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1021" Column="55" TopLine="990"/>
</Position15>
<Position16>
<Filename Value="..\read-me.txt"/>
<Caret Line="31" Column="5"/>
<Caret Line="156" Column="42" TopLine="150"/>
</Position16>
<Position17>
<Filename Value="..\read-me.txt"/>
<Caret Line="46" Column="5" TopLine="16"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1090" Column="25" TopLine="1079"/>
</Position17>
<Position18>
<Filename Value="..\read-me.txt"/>
<Caret Line="64" Column="7" TopLine="34"/>
<Filename Value="umainform.pas"/>
<Caret Line="167" Column="26" TopLine="157"/>
</Position18>
<Position19>
<Filename Value="..\read-me.txt"/>
<Caret Line="68" Column="42" TopLine="38"/>
<Filename Value="umainform.pas"/>
<Caret Line="174" Column="26" TopLine="164"/>
</Position19>
<Position20>
<Filename Value="..\read-me.txt"/>
<Caret Line="71" Column="13" TopLine="41"/>
<Filename Value="umainform.pas"/>
<Caret Line="112" Column="51" TopLine="107"/>
</Position20>
<Position21>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1028" Column="29" TopLine="1021"/>
<Filename Value="umainform.pas"/>
<Caret Line="109" Column="48" TopLine="91"/>
</Position21>
<Position22>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="53" Column="16" TopLine="40"/>
<Caret Line="1100" Column="38" TopLine="1079"/>
</Position22>
<Position23>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="57" Column="51" TopLine="40"/>
<Caret Line="1099" Column="38" TopLine="1079"/>
</Position23>
<Position24>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1185" TopLine="1164"/>
</Position24>
<Position25>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1186" TopLine="1165"/>
<Caret Line="1067" Column="8" TopLine="1042"/>
</Position25>
<Position26>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1188" TopLine="1167"/>
<Caret Line="1058" Column="18" TopLine="1046"/>
</Position26>
<Position27>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1185" TopLine="1167"/>
</Position27>
<Position28>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="1186" TopLine="1167"/>
<Caret Line="169" Column="23" TopLine="148"/>
</Position28>
<Position29>
<Filename Value="..\read-me.txt"/>
<Caret Line="58" Column="50" TopLine="133"/>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="173" Column="23" TopLine="148"/>
</Position29>
<Position30>
<Filename Value="..\tdiclass.pas"/>
<Caret Line="606" Column="21" TopLine="585"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode="default"/>
</RunParams>
</ProjectSession>
<Debugging>
<BreakPoints Count="1">
@ -688,7 +704,7 @@
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="..\tdiclass.pas"/>
<Line Value="1185"/>
<Line Value="1186"/>
</Item1>
</BreakPoints>
</Debugging>

Binary file not shown.

View File

@ -12,7 +12,7 @@ object fMainForm: TfMainForm
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnKeyDown = FormKeyDown
LCLVersion = '1.1'
LCLVersion = '2.0.0.2'
object StatusBar1: TStatusBar
Left = 0
Height = 23
@ -77,7 +77,7 @@ object fMainForm: TfMainForm
Left = 164
Height = 30
Top = 312
Width = 243
Width = 242
Alignment = taCenter
Caption = 'This is a Fixed Page, and cannot be closed.'#13#10'You can configure it on "FixedPages" Property'
ParentColor = False
@ -173,6 +173,15 @@ object fMainForm: TfMainForm
OnClick = Button1Click
TabOrder = 3
end
object chEmulateFormOnActive: TCheckBox
Left = 412
Height = 19
Top = 16
Width = 146
Caption = 'Emulate Form OnActive'
OnChange = chEmulateFormOnActiveChange
TabOrder = 4
end
end
object mEvents: TMemo
Left = 584

View File

@ -16,6 +16,7 @@ type
bToggleLog : TButton ;
Button1 : TButton ;
cbxBackgroundCorner : TComboBox ;
chEmulateFormOnActive: TCheckBox;
Image1 : TImage ;
ImageList1 : TImageList ;
Label1 : TLabel ;
@ -39,6 +40,7 @@ type
procedure bToggleLogClick(Sender : TObject) ;
procedure Button1Click(Sender : TObject) ;
procedure cbxBackgroundCornerChange(Sender : TObject) ;
procedure chEmulateFormOnActiveChange(Sender: TObject);
procedure FormClose(Sender : TObject ; var CloseAction : TCloseAction) ;
procedure FormCloseQuery(Sender : TObject ; var CanClose : boolean) ;
procedure FormCreate(Sender : TObject) ;
@ -102,6 +104,14 @@ begin
TDINoteBook1.BackgroundCorner := TTDIBackgroundCorner( cbxBackgroundCorner.ItemIndex );
end;
procedure TfMainForm.chEmulateFormOnActiveChange(Sender: TObject);
begin
if chEmulateFormOnActive.Checked then
TDINoteBook1.TDIOptions := TDINoteBook1.TDIOptions + [tdiEmulateFormOnActivate]
else
TDINoteBook1.TDIOptions := TDINoteBook1.TDIOptions - [tdiEmulateFormOnActivate];
end;
procedure TfMainForm.bToggleLogClick(Sender : TObject) ;
begin
mEvents.Visible := not mEvents.Visible ;

Binary file not shown.

View File

@ -162,13 +162,19 @@ to explain the component
[*]: Resource modified / improved
[-]: Bug Fix (hopefully)
13/07/2013
[+] Added suport to runs Internal Form OnActivate and OnDeactivate when
changing Pages (by: DSA)
09/01/2019
[+] Added new Option "tdiEmulateFormOnActivate". If Seted, will fire Internal Form
OnActivate and OnDeactivate when changing Pages
(by: DSA)
14/11/2013
[-] Better detection for Form Constraint handling on Linux
(by: DSA and Gall� G�bor)
07/01/2018
[-] Fix compilation for Lazarus 1.9.0 (by: DSA)
03/10/2017
[-] Fix for Closed Buttom Enabled/Disabled detection when Creating and Closing Pages
Lazarus 1.6. (side effect for commit in 27/09/17)
[+] Added Public method: procedure CloseAllTabs;
(by: DSA)
27/09/2017
[-] Fix for Method "RestoreLastFocusedControl". Wrong last focused component
@ -177,11 +183,11 @@ to explain the component
Lazarus 1.8
(by: DSA)
03/10/2017
[-] Fix for Closed Buttom Enabled/Disabled detection when Creating and Closing Pages
Lazarus 1.6. (side effect for commit in 27/09/17)
[+] Added Public method: procedure CloseAllTabs;
(by: DSA)
14/11/2013
[-] Better detection for Form Constraint handling on Linux
(by: DSA and Gall� G�bor)
13/07/2013
[+] Added suport to runs Internal Form OnActivate and OnDeactivate when
changing Pages (by: DSA)
07/01/2018
[-] Fix compilation for Lazarus 1.9.0 (by: DSA)

View File

@ -115,7 +115,7 @@ type
TTDIOption = ( tdiMiddleButtomClosePage, tdiRestoreLastActiveControl,
tdiVerifyIfCanChangePage ) ;
tdiVerifyIfCanChangePage, tdiEmulateFormOnActivate ) ;
TTDIOptions = set of TTDIOption ;
{ TTDINoteBook }
@ -1055,29 +1055,29 @@ begin
end ;
end ;
Result := Result
{$if (lcl_major > 0) or (lcl_release > 30)}
and (inherited CanChange)
{$endif};
{$if (lcl_major > 0) or (lcl_release > 30)}
Result := Result and (inherited CanChange)
{$endif};
// Emulate FormInPage.OnDeactivate //
(*
if Result and (not FIsRemovingAPage) and
([csDesigning, csDestroying, csFreeNotification] * ComponentState = []) then
if Result and (tdiRestoreLastActiveControl in FTDIOptions) then
begin
if (ActivePage is TTDIPage) then
if (not FIsRemovingAPage) and
([csDesigning, csDestroying, csFreeNotification] * ComponentState = []) then
begin
with TTDIPage(ActivePage) do
if (ActivePage is TTDIPage) then
begin
if Assigned( FormInPage ) then
if ([csDesigning, csDestroying, csFreeNotification] * FormInPage.ComponentState = []) then
if Assigned( FormInPage.OnDeactivate ) then
if FormInPage.Visible then
FormInPage.OnDeactivate( Self );
with TTDIPage(ActivePage) do
begin
if Assigned( FormInPage ) then
if ([csDesigning, csDestroying, csFreeNotification] * FormInPage.ComponentState = []) then
if Assigned( FormInPage.OnDeactivate ) then
if FormInPage.Visible then
FormInPage.OnDeactivate( Self );
end ;
end ;
end ;
end ;
*)
end;
end ;
procedure TTDINoteBook.DoChange ;
@ -1087,19 +1087,20 @@ begin
if ([csDesigning, csDestroying, csFreeNotification] * ComponentState <> []) then exit ;
// Emulate FormInPage.OnActivate //
(*
if (not FIsRemovingAPage) and (ActivePage is TTDIPage) then
if tdiRestoreLastActiveControl in FTDIOptions then
begin
with TTDIPage(ActivePage) do
if (not FIsRemovingAPage) and (ActivePage is TTDIPage) then
begin
if Assigned( FormInPage ) then
if ([csDesigning, csDestroying, csFreeNotification] * FormInPage.ComponentState = []) then
if Assigned( FormInPage.OnActivate ) then
if FormInPage.Visible then
FormInPage.OnActivate( Self );
end;
end ;
*)
with TTDIPage(ActivePage) do
begin
if Assigned( FormInPage ) then
if ([csDesigning, csDestroying, csFreeNotification] * FormInPage.ComponentState = []) then
if Assigned( FormInPage.OnActivate ) then
if FormInPage.Visible then
FormInPage.OnActivate( Self );
end;
end ;
end;
CheckInterface;