0
votes

I'm kind of pulling my hair out here. I have a single window application with a NSscrollView and custom NSViews inside of the scroll view. The custom NSViews are registering mouseUP and mouseDown events but my problem is that when the app/window is inactive and you click on it anywhere to make it active the mouseUP and mouseDown events are being triggered in the NSView that you click on.

I overrode the '(BOOL)acceptsFirstMouse:(NSEvent *)theEvent' to return NO just to be sure (i know this is the default.

I can't figure out what I'm doing wrong. I'm principally an iOS developer so my OS X experience is not super extensive. Any input helps. Thanks!

1
so you want the window (or app) to never come to the foreground when the app is in the background and the window is clicked on?Michael Dautermann
I think what he wants is it to come to foreground when it is clicked, but not have the ScrollView's subviews register/respond to the events unless the app is already in the foreground.sammoore
Typically an iOS developer myself, I created a small OS X application to test what you're saying; I'm drawing a NSView subclass inside of a NSScrollView which receives the events but not when the window is initially inactive, i.e. clicking the NSView when the window is inactive doesn't trigger mouseDown, but when it is active it does. Can you confirm this is what you're having trouble with and if so post an example of the code?sammoore
Sorry about the lag in my response. but sammoore you are correct. I know that what I want is the default but It's not happening for me.HenryGale

1 Answers

0
votes

Found the issue. I had a NSTexField on the subview that was capturing the first mouseDown event. Just overlooked it.