Re: tracking area problems on 10.4.11
Re: tracking area problems on 10.4.11
- Subject: Re: tracking area problems on 10.4.11
- From: "Michael Ash" <email@hidden>
- Date: Wed, 2 Jul 2008 14:43:41 -0400
On Tue, Jul 1, 2008 at 5:29 PM, Wesley Smith <email@hidden> wrote:
> Hi,
> I'm trying to get the following events to trigger:
>
> - (void)mouseEntered:(NSEvent *)theEvent
> - (void)mouseExited:(NSEvent *)theEvent
>
> I'm using this call to get it to work:
>
> [[mWindow contentView] addTrackingRect:[mWindow frame]
The rect parameter here is in the coordinate system of the receiver,
so this makes no sense. Instead pass [[mWindow contentView] bounds].
By passing the window's frame, you're taking the window's location in
screen coordinates and then acting as though it's a meaningful
location in view coordinates, which probably puts the tracking area
completely outside the visible area of the window and is therefore
meaningless.
On another note, this tracking rect stuff is really the kind of thing
you should be sending to 'self'. It becomes overly complicated to try
to have some other object manage a view's tracking rect. Instead make
a custom view and have it manage its own tracking rects. This also
allows you to do nice things like set up the tracking rects in
-resetCursorRects, which is the only sane way to do them.
Mike
_______________________________________________
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