寻找 popUpMenuPositioningItem:atLocation:inView: 相当于 10.5
我正在开发一个需要在各种场景下在屏幕上显示上下文菜单的应用程序。在我正在编写的函数中,我无权访问任何 NSWindows 或 NSView。我想使用 popUpMenuPositioningItem:atLocation:inView 因为这个函数在 10.6 中非常适合我。但是,我们要求支持10.5,所以这个功能对我来说不可用。
正如文档中所述,我最感兴趣的功能是:
如果视图为零,则位置为 在屏幕坐标中解释 系统。这允许您弹出一个 菜单与任何窗口断开连接。
基本上,我需要显示屏幕上给定位置的上下文菜单,但没有任何关联的视图。
在10.5上有什么办法可以实现这一点吗?
I'm working on an application that needs to display a context menu on screen in various scenarios. In the function I'm writing, I don't have access to any NSWindows or NSViews. I'd like to use popUpMenuPositioningItem:atLocation:inView as this function works perfectly for me in 10.6. However, we have a requirement to support 10.5, so this function isn't available to me.
The feature I'm most interested in, as stated in the documentation is:
If view is nil, the location is
interpreted in the screen coordinate
system. This allows you to pop up a
menu disconnected from any window.
Basically, I need to display the context menu given a location on screen, but without any associated view.
Is there any way to achieve this on 10.5?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道如何在 Cocoa 中做到这一点,但你也许可以使用 Carbon 函数 PopUpMenuSelect。
I don't know how to do it in Cocoa, but you could maybe use the Carbon function PopUpMenuSelect.