仅当鼠标悬停在 NSPanel 上时才显示 NSToolbar

发布于 2024-09-09 04:14:51 字数 336 浏览 1 评论 0原文

我正在制作一个桌面应用程序,并且仅当鼠标指针位于该 NSPanel 上时,我想显示该 NSPanelNSToolbar。此外,当鼠标指针位于该 NSPanel 上时,NSToolbar 应隐藏。

任何人都可以帮助我检测悬停在 NSPanel 上,并显示和隐藏 NSToolbar (我只能找到如何切换 NSToolbar) ?


当应用程序不活动时也会发生这种情况。

I am making a desktop application and I want to show the NSToolbar of an NSPanel only if the mouse pointer is positioned over that NSPanel. Also, when the mouse pointer is not positioned over that NSPanel, the NSToolbar should be hidden.

Can anyone help me with detecting the hovering over the NSPanel, and showing and hiding the NSToolbar (I can only find how to toggle the NSToolbar)?


This should also happen when the application is not active.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2024-09-16 04:14:51

您应该设置 NSTrackingArea 来查看鼠标何时进入/离开您感兴趣的悬停区域。

You should setup NSTrackingArea to see when the mouse enters/leaves the area you're interested in hovering over.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文