NSWindow - right-click menu

Is there a way to show the menu when right-clicking NSWindow?

+4
source share
2 answers

Rightclick on the view in the window and you will find a property called "menu". Connect this menu property to the menu that should be displayed after right-clicking.

+17
source

Yes. NSWindow inherits from NSResponder , which has convenient methods such as -rightMouseDown:

change

In fact, the best way to do this would be to use a custom NSView subclass for the contentView window and override -menuForEvent: (the method on NSView ) to return your right menu with the NSEvent passed - a right-click event.

+4
source

Source: https://habr.com/ru/post/1341344/


All Articles