我正在尝试打开NSView的mouseDown事件的上下文菜单,但该菜单从未出现。我认为可能是好的,但我一定遗漏了什么。
以下是我的观点:
class MyCustomView < NSView
attr_accessor :menu
def initWithFrame(frame)
super(frame)
return self
end
def mouseDown(event)
puts "---"
puts menu.class.to_s
NSMenu.popUpContextMenu(menu, withEvent:event, forView:self)
puts "---"
end
end这是我单击时的输出:
---
NSMenu
---有没有人知道为什么菜单不显示?谢谢,格雷格
发布于 2012-12-01 07:57:41
我已经能够通过使用NSPopupButton来解决我的问题。
https://stackoverflow.com/questions/13424121
复制相似问题