Adding a tracking area that only tracks enter/exit events seems to be not enough for NSTextView
subviews. Somehow the textview always wins and sets it's IBeamCursor
.
You can try to always enable tracking for mouse move events (NSTrackingMouseMoved
) when adding the tracking area in your NSButton
subclass:
#import "SSWHoverButton.h"
@interface SSWHoverButton()
{
NSTrackingArea* trackingArea;
}
@end
@implementation SSWHoverButton
- (void)mouseMoved:(NSEvent*)theEvent
{
[[NSCursor arrowCursor] set];
}
- (void)updateTrackingAreas
{
if(trackingArea != nil)
{
[self removeTrackingArea:trackingArea];
}
NSTrackingAreaOptions opts = (NSTrackingMouseMoved|NSTrackingActiveAlways);
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
options:opts
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
}
- (void)dealloc
{
[self removeTrackingArea:trackingArea];
}
@end