I have to two subviews associated with a view. One is a transparent view that handles a right click, the other a nsview with an nsimageview subview. For some reason the right click works over any part of the superview except the part within the nsimageview. The transparent view is on top of the other view yet the right mouse down event is not firing.
Asked
Active
Viewed 668 times
2
-
Same here... Really need that answer. – Mazyod Sep 11 '13 at 21:13
1 Answers
3
I finally solved it by subclassing the image view and overriding the hit test method to return nil. The full implementation is below :
@implementation TTBaseImageView
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect
{
// Drawing code here.
[super drawRect:dirtyRect];
}
-(BOOL)isFlipped
{
return YES;
}
-(BOOL)acceptsFirstResponder
{
return NO;
}
-(BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
return NO;
}
-(NSView *)hitTest:(NSPoint)aPoint
{
return nil;
}
@end

VBK
- 1,435
- 1
- 15
- 34
-
Damn... What an unnecessarily workaround... APPLE PLEASE UPDATE THE COCOA FRAMEWORK – Mazyod Sep 13 '13 at 01:37