mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 09:20:49 +02:00
carbon: fix focusing, allowing an empty form to gain focus. bugs #16823,#16866
git-svn-id: trunk@27041 -
This commit is contained in:
parent
fa651f6d59
commit
3048fbf9e9
@ -918,7 +918,7 @@ var
|
|||||||
DoActivate: Boolean;
|
DoActivate: Boolean;
|
||||||
EventKind: UInt32;
|
EventKind: UInt32;
|
||||||
Control: ControlRef;
|
Control: ControlRef;
|
||||||
FocusWidget: TCarbonControl;
|
FocusWidget: TCarbonWidget;
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseWindowEvent}
|
{$IFDEF VerboseWindowEvent}
|
||||||
DebugLn('CarbonWindow_ActivateProc ', DbgSName(AWidget.LCLObject));
|
DebugLn('CarbonWindow_ActivateProc ', DbgSName(AWidget.LCLObject));
|
||||||
@ -952,12 +952,17 @@ begin
|
|||||||
// force set and kill focus of focused control
|
// force set and kill focus of focused control
|
||||||
Control := nil;
|
Control := nil;
|
||||||
OSError(GetKeyboardFocus(TCarbonWindow(AWidget).fWindowRef, Control), 'CarbonWindow_ActivateProc', SGetKeyboardFocus);
|
OSError(GetKeyboardFocus(TCarbonWindow(AWidget).fWindowRef, Control), 'CarbonWindow_ActivateProc', SGetKeyboardFocus);
|
||||||
if Control <> nil then
|
if Control <> nil
|
||||||
begin
|
then FocusWidget := GetCarbonControl(Control)
|
||||||
FocusWidget := GetCarbonControl(Control);
|
else FocusWidget := nil;
|
||||||
|
|
||||||
|
// Focusing the form without controls
|
||||||
|
if (FocusWidget = nil) and DoActivate then FocusWidget:=AWidget;
|
||||||
|
|
||||||
if FocusWidget <> nil then
|
if FocusWidget <> nil then
|
||||||
if DoActivate then FocusWidget.FocusSet
|
begin
|
||||||
|
if DoActivate
|
||||||
|
then FocusWidget.FocusSet
|
||||||
else FocusWidget.FocusKilled;
|
else FocusWidget.FocusKilled;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user