diff --git a/components/tdi/Demo/TDIDemo.lpi b/components/tdi/Demo/TDIDemo.lpi index 94869ad2c..6540bcb04 100644 --- a/components/tdi/Demo/TDIDemo.lpi +++ b/components/tdi/Demo/TDIDemo.lpi @@ -1,7 +1,7 @@ - + @@ -22,13 +22,12 @@ - - - - - + + + + diff --git a/components/tdi/Demo/TDIDemo.lps b/components/tdi/Demo/TDIDemo.lps index 00936dfe4..9dde90a6c 100644 --- a/components/tdi/Demo/TDIDemo.lps +++ b/components/tdi/Demo/TDIDemo.lps @@ -2,9 +2,9 @@ - + - + @@ -29,8 +29,8 @@ - - + + @@ -45,7 +45,7 @@ - + @@ -55,8 +55,9 @@ - - + + + @@ -65,8 +66,8 @@ - - + + @@ -74,18 +75,17 @@ - + - + - - + @@ -137,11 +137,10 @@ - + - - + @@ -153,11 +152,10 @@ - - - + + + - @@ -326,11 +324,10 @@ - + - - + @@ -498,10 +495,10 @@ - - - - + + + + @@ -546,11 +543,10 @@ - - + - + @@ -561,125 +557,145 @@ + + + + + + + + + + + + + + + + + - + - - + - + - + - + - - + - + - + - - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - + - - + - + - - + - - + + + + + + + + + + @@ -688,7 +704,7 @@ - + diff --git a/components/tdi/Demo/TDIDemo.res b/components/tdi/Demo/TDIDemo.res index a6fa3db25..1adb0406c 100644 Binary files a/components/tdi/Demo/TDIDemo.res and b/components/tdi/Demo/TDIDemo.res differ diff --git a/components/tdi/Demo/umainform.lfm b/components/tdi/Demo/umainform.lfm index f3e5077c0..12141e83d 100644 --- a/components/tdi/Demo/umainform.lfm +++ b/components/tdi/Demo/umainform.lfm @@ -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 diff --git a/components/tdi/Demo/umainform.pas b/components/tdi/Demo/umainform.pas index 2e96d162c..575c63426 100644 --- a/components/tdi/Demo/umainform.pas +++ b/components/tdi/Demo/umainform.pas @@ -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 ; diff --git a/components/tdi/opm/TDINoteBook.zip b/components/tdi/opm/TDINoteBook.zip index 8e0e75b45..fb80a3d43 100644 Binary files a/components/tdi/opm/TDINoteBook.zip and b/components/tdi/opm/TDINoteBook.zip differ diff --git a/components/tdi/read-me.txt b/components/tdi/read-me.txt index c979e33d1..b5c780125 100644 --- a/components/tdi/read-me.txt +++ b/components/tdi/read-me.txt @@ -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) diff --git a/components/tdi/tdiclass.pas b/components/tdi/tdiclass.pas index 952c96154..7b5a7e729 100644 --- a/components/tdi/tdiclass.pas +++ b/components/tdi/tdiclass.pas @@ -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;