27/09/2017

[-] Fix for Method "RestoreLastFocusedControl". Wrong last focused component
    detection
[-] Fix for Closed Buttom Enabled/Disabled detection when Creating and Closing Pages
    Lazarus 1.8
    (by: DSA)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6023 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
dopi
2017-09-29 02:09:24 +00:00
parent 244d419742
commit ea82879868
2 changed files with 28 additions and 9 deletions

View File

@ -171,3 +171,10 @@ to explain the component
[-] Better detection for Form Constraint handling on Linux [-] Better detection for Form Constraint handling on Linux
(by: DSA and Gall� G�bor) (by: DSA and Gall� G�bor)
27/09/2017
[-] Fix for Method "RestoreLastFocusedControl". Wrong last focused component
detection
[-] Fix for Closed Buttom Enabled/Disabled detection when Creating and Closing Pages
Lazarus 1.8
(by: DSA)

View File

@ -283,22 +283,28 @@ begin
end ; end ;
procedure TTDIPage.RestoreLastFocusedControl ; procedure TTDIPage.RestoreLastFocusedControl ;
var
FocusRestored: Boolean;
begin begin
FocusRestored := False;
if Assigned( fsLastActiveControl ) then if Assigned( fsLastActiveControl ) then
begin begin
if fsLastActiveControl <> Screen.ActiveControl then if fsLastActiveControl <> Screen.ActiveControl then
begin begin
if fsLastActiveControl.Visible and fsLastActiveControl.Enabled then if fsLastActiveControl.CanSetFocus then
begin begin
try try
fsLastActiveControl.SetFocus ; fsLastActiveControl.SetFocus;
FocusRestored := True;
//FormInPage.ActiveControl := fsLastActiveControl; //FormInPage.ActiveControl := fsLastActiveControl;
except except
end ; end ;
end ; end ;
end end
end end;
else
if not FocusRestored then
begin begin
{ No LastActiveControle ? Ok, if current Screen control isn't in TabSheet, { No LastActiveControle ? Ok, if current Screen control isn't in TabSheet,
go to first Control on TabSheet... } go to first Control on TabSheet... }
@ -709,9 +715,10 @@ procedure TTDINoteBook.ShowFormInPage(AForm : TForm ; ImageIndex : Integer) ;
Var Var
NewPage : TTDIPage ; NewPage : TTDIPage ;
AlreadyExistingPage : Integer ; AlreadyExistingPage : Integer ;
DoCheckInterface: Boolean;
begin begin
if not Assigned( AForm ) then if not Assigned( AForm ) then
raise ETDIError.Create( sFormNotAssigned ) ; raise ETDIError.Create( sFormNotAssigned ) ;
// Looking for a Page with same AForm Object // // Looking for a Page with same AForm Object //
AlreadyExistingPage := FindFormInPages( AForm ); AlreadyExistingPage := FindFormInPages( AForm );
@ -721,6 +728,8 @@ begin
exit ; exit ;
end ; end ;
DoCheckInterface := (PageCount = 1);
// Create a new Page // Create a new Page
NewPage := TTDIPage.Create(Self); NewPage := TTDIPage.Create(Self);
NewPage.ImageIndex := ImageIndex; NewPage.ImageIndex := ImageIndex;
@ -745,7 +754,7 @@ begin
AForm.Align := alClient; // Try to expand the Form AForm.Align := alClient; // Try to expand the Form
NewPage.CheckFormAlign ; NewPage.CheckFormAlign ;
if PageCount = 1 then if DoCheckInterface then
CheckInterface; CheckInterface;
end ; end ;
@ -1114,9 +1123,12 @@ end ;
procedure TTDINoteBook.RemovePage(Index : Integer) ; procedure TTDINoteBook.RemovePage(Index : Integer) ;
Var Var
CanRemovePage : Boolean ; CanRemovePage: Boolean ;
APage : TTabSheet; APage: TTabSheet;
begin begin
if (Index >= PageCount) or (Index < 0) then
Exit;
CanRemovePage := True; CanRemovePage := True;
FIsRemovingAPage := True; FIsRemovingAPage := True;
APage := Pages[Index] ; APage := Pages[Index] ;
@ -1144,7 +1156,7 @@ begin
APage.Free; APage.Free;
{$endif} {$endif}
if PageCount < 1 then // On this case, DoChange is not fired // if (PageCount <= 1) then // In this situation... DoChange is not fired //
CheckInterface; CheckInterface;
end ; end ;
finally finally