Re: trackingAreas can be snuck up on without triggering?
Re: trackingAreas can be snuck up on without triggering?
- Subject: Re: trackingAreas can be snuck up on without triggering?
- From: Quincey Morris <email@hidden>
- Date: Sat, 19 May 2012 22:29:13 -0700
On May 19, 2012, at 22:10 , email@hidden wrote:
> If I whip the mouse into the window's content area, my cursorUpdate method is called and I see the correct cursor. If I slowly sneak the mouse into my window's content area, I see the window resize cursor for a moment as I cross into the window content area (I'm running Lion), then... nothing. The cursor reverts to the arrow cursor, and my cursorUpdate: method is not called, even though I am well into my view's rectangle.
Does the window contain a NSScrollView? If so, there are certain places/timings where the scroll view takes control of the cursor. IIRC, the easiest workaround is to set scrollView.documentCursor to the same cursor you set for your view in 'cursorUpdate:' -- though I haven't tested the effects of this in Lion.
Another [or a complementary] approach is to invoke 'cursorUpdate:' like this:
- (void) mouseMoved: (NSEvent*) event {
[self cursorUpdate: event];
… other code for this method, if you have it …
}
It doesn't hurt to do the same in 'mouseDown:', 'mouseUp:', 'mouseDragged:', 'mouseEntered:' and 'mouseExited:', if you use any of those. This saves a lot of puzzling over other "missing" cursor updates, and it often simplifies your code by centralizing cursor setting.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden