mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 19:00:30 +02:00
cocoa: initial (out of event loop) focus setting
git-svn-id: trunk@61398 -
This commit is contained in:
parent
6f8ac4d6a1
commit
2d8ade5a97
@ -2394,6 +2394,7 @@ function TCocoaWidgetSet.SetFocus(Handle: HWND): HWND;
|
||||
var
|
||||
Obj: NSObject;
|
||||
lView: NSView;
|
||||
cb: ICommonCallback;
|
||||
begin
|
||||
if Handle <> 0 then
|
||||
begin
|
||||
@ -2414,7 +2415,15 @@ begin
|
||||
if lView.window <> nil then
|
||||
begin
|
||||
lView.window.makeKeyWindow;
|
||||
lView.window.makeFirstResponder(lView.lclContentView);
|
||||
if lView.window.makeFirstResponder(lView.lclContentView) then
|
||||
begin
|
||||
// initial focus set (right before the event loop starts)
|
||||
if not Assigned(NSApp.currentEvent) then
|
||||
begin
|
||||
cb := lView.lclGetCallback;
|
||||
if Assigned(cb) then cb.BecomeFirstResponder;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
Result := 0; // the view is on window, cannot set focus. Fail
|
||||
end else
|
||||
|
Loading…
Reference in New Issue
Block a user