Re: NSCursor category
Re: NSCursor category
- Subject: Re: NSCursor category
- From: Yann Bizeul <email@hidden>
- Date: Wed, 30 Jun 2004 09:20:39 +0200
>
[...]
>
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.