I have been able to solve my problem by using NSPopupButton.
MacRuby: open popUpContextMenu
-
29-11-2021 - |
Question
I am trying to open a context menu on the mouseDown event of my NSView but the menu never appears. I think the could is good but I must be missing something.
Here i my view:
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
And here is the output when I click:
---
NSMenu
---
Does anyone has an idea why the menu does not show? Thanks, Greg
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow