On Jul 17, 2011, at 12:22, Gabriel Roth wrote:
myTrackingArea = [[NSTrackingArea alloc]
initWithRect:self.blueView.frame
options:(NSTrackingMouseEnteredAndExited |
NSTrackingActiveInActiveApp) owner:self userInfo:nil];
[self.blueView addTrackingArea:myTrackingArea];
Well, one
Well, one thing that's wrong is that the tracking area is supposed to be in
the target view's coordinate system,
that is, blueView's, but you specified it in blueView's parent view's
coordinate system.
IAC, if what you want is to track the mouse when it enter's blueView, then
most likely
On Jul 18, 2011, at 04:59, Gabriel Roth wrote:
Thanks for the corrections. But changing the line in question to
myTrackingArea = [[NSTrackingArea alloc]
initWithRect:self.blueView.bounds
options:(NSTrackingMouseEnteredAndExited |
NSTrackingActiveInActiveApp | NSTrackingInVisibleRect )
Yes, that works—thanks very much.
If anyone can explain why my original version didn't
work, I'd appreciate it. My understanding was that the NSTrackingArea
object would be allocate, initialized, and assigned to an ivar in the
applicationDidFinishLaunching: method, and could then be added to and
I'm attempting to add, remove, and re-add an instance of
NSTrackingArea to a custom view. Adding works fine; removing works
fine; but when I attempt to add it to the view again, the tracking
area is not added.
Here's the code:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification