I have a subclassed NSView
which is part of a .xib-file of a subclassed NSDocument
, which gets alive by the default behaviour of NSDocumentController
's openDocument:
method. In this subclassed NSView
I have implemented the methods awakeFromNib
, in which the view's NSWindow
setAcceptsMouseMovedEvents:YES
method is called, and acceptsFirstMouse:
, which returns YES
. But my mouseMoved:
method implementation of my subclassed NSView
doesn't get called when I move the mouse over it. What might be the problem?
Be sure to request the mouseMoved event is sent:
NSTrackingAreaOptions options = (NSTrackingActiveAlways | NSTrackingInVisibleRect |
NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved);
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[self bounds]
options:options
owner:self
userInfo:nil];