Reputation: 1430
my View controller works fine so far except one thing: I have a couple of MouseEvents and some fire and others don´t.
- (void)mouseWasHeld: (NSTimer *)tim {
**// this works not**
}
- (void) mouseMoved:(NSEvent*)someEvent {
**// this works not**
}
-(void)mouseDown:(NSEvent *)event {
// this works
}
-(void)mouseDragged:(NSEvent *)event {
// this works
}
-(void)mouseUp:(NSEvent *)event {
// this works
}
I don´t see why two events don´t fire any clues?
Thanks a lot Ronald
Upvotes: 1
Views: 228
Reputation: 5230
mouseMoved:
will not be called unless you add the Tracking area.
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways;
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:self.frame options:options owner:self userInfo:nil];
[self addTrackingArea:trackingArea];
Upvotes: 1
Reputation: 81878
mouseWasHeld:
seems to be a callback of a timer setup anywhere else. Look for @selector(mouseWasHeld:)
in your code and find out why the timer is not scheduled.mouseMoved:
is only dispatched if the window is told to do so using -[NSWindow setAcceptsMouseMovedEvents:]
.Upvotes: 2