MacFiend
2006.05.27, 02:48 PM
I've got an NSWindow subclass which I want to handle all user-input events (ie, mouse, keyboard, etc.).
Everything is working good except for the NSResponder rightMouseDown: function. For whatever reason, it isn't being called - mouseDown:, rightMouseUp:, and rightMouseDragged: all work - so I cannot pinpoint why rightMouseDown: wouldn't be called?
I've searched Google, and came up with this:
http://developer.apple.com/releasenotes/Cocoa/AppKitOlderNotes.html
"A RightMouseDown in a window of an inactive application will not be delivered to -[NSWindow sendEvent:]. The event will be delivered to -[NSApplication sendEvent:], but the windowNumber will be 0."
My application is no inactive when I attempt the right-click, so I'm disregarding this note.
I also came across this:
http://www.idevapps.com/forum/archive/index.php/t-3679.html
another programmer having the exact same problem as mine.
Does anybody know what the deal is?
[Edit]
A reply suggested catching the event in an NSApp subclass - sure, it'd probably work - but why have a rightMouseDown: event if NSResponder isn't going to respond to it??
Someone also suggested that an NSView on the window could be 'consuming' the event - so I tried implementing rightMouseDown: in my NSView subclass, and still no good.
[Edit 2]
I figured out a workaround: I set my NSView subclass as the window's contentView, and now it receives rightMouseDown:
I'm still confused as to why the NSWindow would receive every single event except for rightMouseDown:
I guess this will have to do for now.
Everything is working good except for the NSResponder rightMouseDown: function. For whatever reason, it isn't being called - mouseDown:, rightMouseUp:, and rightMouseDragged: all work - so I cannot pinpoint why rightMouseDown: wouldn't be called?
I've searched Google, and came up with this:
http://developer.apple.com/releasenotes/Cocoa/AppKitOlderNotes.html
"A RightMouseDown in a window of an inactive application will not be delivered to -[NSWindow sendEvent:]. The event will be delivered to -[NSApplication sendEvent:], but the windowNumber will be 0."
My application is no inactive when I attempt the right-click, so I'm disregarding this note.
I also came across this:
http://www.idevapps.com/forum/archive/index.php/t-3679.html
another programmer having the exact same problem as mine.
Does anybody know what the deal is?
[Edit]
A reply suggested catching the event in an NSApp subclass - sure, it'd probably work - but why have a rightMouseDown: event if NSResponder isn't going to respond to it??
Someone also suggested that an NSView on the window could be 'consuming' the event - so I tried implementing rightMouseDown: in my NSView subclass, and still no good.
[Edit 2]
I figured out a workaround: I set my NSView subclass as the window's contentView, and now it receives rightMouseDown:
I'm still confused as to why the NSWindow would receive every single event except for rightMouseDown:
I guess this will have to do for now.