Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCursor category



> [...]
> However, I want to do some other things such as hover text, but
> "addTrackingRect:owner:userData:assumeInside:"; cannot be used the same
> way, as there is no "resetTrackingRects" or equivalent method as far
> as I can see. Instead the tracking rects have to be individually
> removed when the NSView changes shape which is a pain because I don't
> want to keep track of them manually.
>
> So firstly, am I missing something with tracking rects? Why are they
> so much more difficult to use than cursor rects?
You are right, cursorRects are easier to work with than trackingRect

> @implementation NSCursor (NotificationCursor)
> + (NSCursor *)notificationCursor
> {
> NSCursor *cursor = [NSCursor resizeLeftRightCursor];
> [cursor setOnMouseEntered:YES];
> return cursor;
> }
> - (void)mouseEntered:(NSEvent *)event
> {
> NSLog(@"mouseEntered");
> // do extra stuff here
> }
> @end
From Apple's docs : (NSCursor/mouseEntered:)
"This message is automatically sent to the receiver when the cursor
enters a tracking rectangle owned by the receiver..."
What I understand from this, is that this method is called for a
trackingRect, not a cursorRect, and only if the owner is your cursor.
Is this the case ?

Personaly, I always use resetCursorRect in my view to play with
trackingRect *and* cursorrect. Because this method is always called
when rects need to be reset, you can do your stuff here. The only thing
to not forget, is keep a reference for each of your trackingRect,
delete them all in resetCursorRect, and re create them after this.

Any advice is welcome !

--
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSCursor category (From: Hamish Allan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.