I have a very strange problem with NSMenu.
About half of the NSMenuItems I use have custom views based on the setView method: NSMenuItem. In this user view, I implemented mouseUp: catch when the user clicks on a menu item, and this works great the first time the menu is opened.
The second time, however, mouseUp is not called in any of these menu items if I hold down the mouse button while clicking. However, if I click down, then move the cursor so slowly and release mouseUp. Therefore, for some reason, something intercepts these events, but only the second time a menu appears, and it passes if the cursor moves after the mouseDown event. (For some reason, mouseDown is never called, although the first or second menu appears).
Has anyone understood what is going on here? What is the interception of mouse events and why do they go through my user view when the menu first appears, but not the second?
objective-c cocoa macos nsmenu nsmenuitem
Christian A. Strømmen
source share