mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 22:40:24 +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;
|
||||
EventKind: UInt32;
|
||||
Control: ControlRef;
|
||||
FocusWidget: TCarbonControl;
|
||||
FocusWidget: TCarbonWidget;
|
||||
begin
|
||||
{$IFDEF VerboseWindowEvent}
|
||||
DebugLn('CarbonWindow_ActivateProc ', DbgSName(AWidget.LCLObject));
|
||||
@ -952,13 +952,18 @@ begin
|
||||
// force set and kill focus of focused control
|
||||
Control := nil;
|
||||
OSError(GetKeyboardFocus(TCarbonWindow(AWidget).fWindowRef, Control), 'CarbonWindow_ActivateProc', SGetKeyboardFocus);
|
||||
if Control <> nil then
|
||||
begin
|
||||
FocusWidget := GetCarbonControl(Control);
|
||||
if Control <> nil
|
||||
then FocusWidget := GetCarbonControl(Control)
|
||||
else FocusWidget := nil;
|
||||
|
||||
if FocusWidget <> nil then
|
||||
if DoActivate then FocusWidget.FocusSet
|
||||
else FocusWidget.FocusKilled;
|
||||
// Focusing the form without controls
|
||||
if (FocusWidget = nil) and DoActivate then FocusWidget:=AWidget;
|
||||
|
||||
if FocusWidget <> nil then
|
||||
begin
|
||||
if DoActivate
|
||||
then FocusWidget.FocusSet
|
||||
else FocusWidget.FocusKilled;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user