Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i pop up NSMenu at mouse cursor position?

Tags:

I want to react on hot key press by displaying NSMenu at mouse cursor position.

My application is UIElement and doesn't have its own window.

I know there is method of NSMenu :

-(void)popUpContextMenu:(NSMenu *)menu
              withEvent:(NSEvent *)event
                forView:(NSView *)view;

But it seems it doesn't work when there is no view :(.

Should I create a fake transparent view at mouse cursor position, and then display there NSMenu, or there is better way?

May it can be implemented using Carbon?


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!