Question

I have implemented a custom NSView (marked as ) and am able to get mouseUp:, mouseDown: and mouseMoved: events. To this I have acceptsFirstResponder returning YES, and also call the following in awakeFromNib:

[[self window] makeFirstResponder:self];
[[self window] seAcceptsMouseMovedEvents:true];

However the extremely strange thing is that if I click and drag, the mouseMoved: events stop coming in until I let go of the mouse button and get a mouseUp:

I have seen other related posts, but they all say that if the view is first responder (and it is), then I should be receiving these events.

Why is the mousemoved: event stopping?

Was it helpful?

Solution

-(void)mouseDragged:(NSEvent *)event

is called instead of

-(void)mouseMoved:(NSEvent *)event

when the left mouse button is down. So if you have anything you need to do in both cases, call a common method to do it from both of these.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top