I wanted to change the cursor in my cocoa application. I've followed the example in this answer, with success.
I have an NSView
, let's call it NSViewA
, behind another NSView
, NSViewB
. NSViewA
contains a subclassed NSButton
where the cursor has been changed. NSViewA
and NSViewB
have the same superview. So something like this:
- NSWindow
- NSViewA
- NSButtonSubclass
- NSViewB
My problem is that when NSViewB
is shown, and the cursor is ontop of NSViewB
, but in the same x y coordinates of the NSButton
behind NSViewB
, the cursor changes to that specified in the NSButton
subclass.
How do I stop this behaviour?
The reason for this layout is that I'm creating a 'lightbox' control. If you think something along the lines of the NSWindow
greying out, and a centred box appearing showing an error message. That sort of thing.
I previously had a problem where you could still click buttons, etc, behind NSViewB
. This was solved by suppressing mouseDown:
and mouseUp:
. I've tried doing something similar with other mouse-related events, such as mouseEntered:
and mouseExited:
with no luck.