mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:30:28 +02:00
lcl: better bullet-proof LCL approach for r51808 #cf74370262, issue #28631
git-svn-id: trunk@51810 -
This commit is contained in:
parent
385957f10b
commit
2425ad6bff
@ -28,9 +28,7 @@ function TCommonDialog.Execute: boolean;
|
|||||||
var
|
var
|
||||||
DisabledList: TList;
|
DisabledList: TList;
|
||||||
SavedFocusState: TFocusState;
|
SavedFocusState: TFocusState;
|
||||||
FocusedWindow: HWnd;
|
|
||||||
begin
|
begin
|
||||||
FocusedWindow := GetFocus;
|
|
||||||
SavedFocusState := SaveFocusState;
|
SavedFocusState := SaveFocusState;
|
||||||
DisabledList := Screen.DisableForms(Screen.ActiveForm);
|
DisabledList := Screen.DisableForms(Screen.ActiveForm);
|
||||||
try
|
try
|
||||||
@ -41,8 +39,9 @@ begin
|
|||||||
finally
|
finally
|
||||||
Screen.EnableForms(DisabledList);
|
Screen.EnableForms(DisabledList);
|
||||||
RestoreFocusState(SavedFocusState);
|
RestoreFocusState(SavedFocusState);
|
||||||
if IsWindow(FocusedWindow) and (GetFocus<>FocusedWindow) then
|
if (Screen.ActiveControl<>nil) and (Screen.ActiveControl.HandleAllocated)
|
||||||
SetFocus(FocusedWindow);
|
and (GetFocus<>Screen.ActiveControl.Handle) then
|
||||||
|
SetFocus(Screen.ActiveControl.Handle); // must restore focus after Screen.EnableForms
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user