On Tue, Jul 1, 2008 at 5:29 PM, Wesley Smith <[EMAIL PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to