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
|
||||
DisabledList: TList;
|
||||
SavedFocusState: TFocusState;
|
||||
FocusedWindow: HWnd;
|
||||
begin
|
||||
FocusedWindow := GetFocus;
|
||||
SavedFocusState := SaveFocusState;
|
||||
DisabledList := Screen.DisableForms(Screen.ActiveForm);
|
||||
try
|
||||
@ -41,8 +39,9 @@ begin
|
||||
finally
|
||||
Screen.EnableForms(DisabledList);
|
||||
RestoreFocusState(SavedFocusState);
|
||||
if IsWindow(FocusedWindow) and (GetFocus<>FocusedWindow) then
|
||||
SetFocus(FocusedWindow);
|
||||
if (Screen.ActiveControl<>nil) and (Screen.ActiveControl.HandleAllocated)
|
||||
and (GetFocus<>Screen.ActiveControl.Handle) then
|
||||
SetFocus(Screen.ActiveControl.Handle); // must restore focus after Screen.EnableForms
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user