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: Lee Ann Rucker <email@hidden>
- Date: Sun, 20 May 2012 10:45:45 -0700 (PDT)
Sounds like your tracking area overlaps the 3 pixel wide grow zone tracking area. It's an interesting area - if you do a hitTest as the mouse is entering the window it won't hit your content in that zone, but it will if you start from > 3 pixels in and move out.
But if you're only updating the cursor, why not try addCursorRect:cursor: ? Presumably that's smart enough to know about the grow zone.
----- Original Message -----
From: email@hidden
To: "Cocoa Dev" <email@hidden>
Sent: Saturday, May 19, 2012 10:10:34 PM
Subject: trackingAreas can be snuck up on without triggering?
I have a view for which I am adding a tracking area so that I can update the cursor. The view entirely fills my window and is the only view in the window's content view.
The tracking area is being registered thusly:
- (void) awakeFromNib
{
NSTrackingArea* trackingArea = [[NSTrackingArea alloc ] initWithRect:[self bounds]
options:NSTrackingCursorUpdate|NSTrackingActiveInActiveApp
owner:self
userInfo:nil];
[self addTrackingArea:trackingArea];
}
and I have defined in my view:
- (void) cursorUpdate:(NSEvent *)event
{
NSLog(@"cursorUpdate: %@", [NSDate date]);
[[NSCursor openHandCursor] set];
}
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.
If I inset my view from the boundaries of the window a bit (16-ish pixels), things behave as expected.
What am I doing wrong?
Sample project at <http://bugs.muratnkonar.com/trackingareas.zip>
_murat
_______________________________________________
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
_______________________________________________
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