From 78bcc9b70aa1ea71d0d86bb3e0769eba4e18becc Mon Sep 17 00:00:00 2001 From: rich2014 Date: Mon, 11 Sep 2023 21:41:32 +0800 Subject: [PATCH] Cocoa: improved in TCocoaWSWinControl.SetChildZPosition() --- lcl/interfaces/cocoa/cocoawscommon.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawscommon.pas b/lcl/interfaces/cocoa/cocoawscommon.pas index 65aa1bc126..89101cb0f7 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -1974,6 +1974,8 @@ begin pr := NSView(AWinControl.Handle).lclContentView; + if pr.subviews.count <= 1 then exit; + // 1. sorting is a better option than removing / adding a view. // whenever a focused (firstrepsonder view) is removed and added to front, // focus is lost. the issue was exposed by