I have a macOS application that contains an NSTableView and an NSVisualEffectView. The visual effect view is acting like a bar at the bottom of the window, it is in the table view (containing a few buttons/etc..).
Anyway if I want to move the NSWindow by dragging the visual effect view, it will only work if the table view is not below the visual effect view. The reason I want visual effect view to be above the table view is so that I get a nice blur effect when then the user is scrolling through the table view content.
However, when the visual effect view is above the table view, the mouse/drag/etc events are not registered. Instead, they get passed to the table view. How can I stop this from happening?
I tried subclassing NSVisualEffectView, but everything I have tried has failed. Here is my code:
#import <Cocoa/Cocoa.h>
@interface BottomMainBar : NSVisualEffectView {
} @end
Here is the implementation code:
#import "BottomMainbar.h"
@implementation BottomMainBar
-(void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
[self setWantsLayer:YES];
[self.window setMovableByWindowBackground:YES];
[self setAcceptsTouchEvents:YES];
[self registeredDraggedTypes];
}
-(void)mouseDown:(NSEvent *)event {
[super mouseDown:event];
}
-(void)mouseDragged:(NSEvent *)event {
[super mouseDragged:event];
}
-(void)mouseUp:(NSEvent *)event {
[super mouseUp:event];
}
-(void)mouseEntered:(NSEvent *)event {
[super mouseEntered:event];
}
-(void)mouseExited:(NSEvent *)event {
[super mouseExited:event];
}
-(BOOL)mouseDownCanMoveWindow {
return YES;
}
-(BOOL)acceptsFirstMouse:(NSEvent *)event {
return YES;
}
@end
Nothing I have tried has worked, how can I stop the visual effect view from passing on the mouse events to the layer below it?
Thanks for your time, Dan.