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