diff --git a/lcl/interfaces/cocoa/cocoawindows.pas b/lcl/interfaces/cocoa/cocoawindows.pas index 71a1f9339c..2aacb3a7d9 100644 --- a/lcl/interfaces/cocoa/cocoawindows.pas +++ b/lcl/interfaces/cocoa/cocoawindows.pas @@ -122,6 +122,8 @@ type private // for the reentrancy of makeFirstResponder() makeFirstResponderCount: Integer; + private + procedure DoWindowDidBecomeKey(); message 'DoWindowDidBecomeKey'; protected fieldEditor: TCocoaFieldEditor; firedMouseEvent: Boolean; @@ -235,6 +237,9 @@ type implementation +uses + CocoaInt; + { TCocoaDesignOverlay } procedure TCocoaDesignOverlay.drawRect(r: NSRect); @@ -756,6 +761,13 @@ begin callback.Close; end; +procedure TCocoaWindow.DoWindowDidBecomeKey(); +begin + if Assigned(CocoaWidgetSet.CurModalForm) then + CocoaWidgetSet.CurModalForm.orderFront(nil); + CursorHelper.SetCursorOnActive(); +end; + procedure TCocoaWindow.windowDidBecomeKey(notification: NSNotification); begin // forcing to keep the level as all other LCL windows @@ -780,7 +792,7 @@ begin and (contentView.isKindOfClass(TCocoaWindowContent)) then self.makeFirstResponder( TCocoaWindowContent(contentView).documentView ); - CursorHelper.SetCursorOnActive; + performSelector_withObject_afterDelay( ObjCSelector('DoWindowDidBecomeKey'), nil, 0.1 ); end; procedure TCocoaWindow.windowDidResignKey(notification: NSNotification);