Re: Set focus on NSTextField in an NSMenuItem
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1666117251; bh=MrYZEuQUty+0iBNPesUHvJaAEPUMiZQv0v/IglJ8/eM=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id; b=groA3zV3seq6de808FuhQoK8wJ7EIadKNRX2C8IZLNL27XX4jeAPmylf+/FvpXVeM fWjRYB8i3xe2Q0EkBAs33GIzn2L2uXKMxCOFvmsX3O03DpDS7/mK7noFj39UghogDC TtM+wYUvOE6z1OKnTDdsYHS1ohgABgbeE9Fa+Teg4TXlXwAyzNr1EZVHJgcak8Ahyq bjNtgweWDsuIsiMD/TEwJvCv6Mi1oqpTqQw2e5aF/ApoAxejdq9jArDkzgaZo7G3Z0 y19hVjsjbk1YrZMpoyz9NGORAgzhBHwyRWU6NUeiZz2SPHWYw1CQXMdP1uc3kjAE2H Dyya2rys/WILg==
On 18. 10. 2022., at 19:11, Alex Zavatone wrote:
I am speaking from an iOS perspective but, is there something like makeFirstResponder?
Yes, there is. It should be sent to an NSWindow instance and I tried to do that in -[NSMenuDelegate menuNeedsUpdate:], or -[NSMenuDelegate menuWillOpen:] (in both cases after some delay, as the window of the text field is still set at the time those delegate messages are received) and I also subclassed NSTextView and tried to call -[[self window] makeFirstResponder:self] in overridden -[NSView viewDidMoveToWindow] method, but those calls have no effect. Even if it worked, it’d still be a problem setting the focus on the text field by clicking on it. -- Dragan _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dragan Milić via Cocoa-dev