Skip navigation.
 
mlRe: tracking area problems on 10.4.11
FROM : Michael Ash
DATE : Wed Jul 02 20:43:41 2008

On Tue, Jul 1, 2008 at 5:29 PM, Wesley Smith <wesley.<email_removed>> 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

Related mailsAuthorDate
mltracking area problems on 10.4.11 Wesley Smith Jul 1, 23:29
mlRe: tracking area problems on 10.4.11 Tony Becker Jul 2, 19:21
mlRe: tracking area problems on 10.4.11 Wesley Smith Jul 2, 20:10
mlRe: tracking area problems on 10.4.11 Tony Becker Jul 2, 20:18
mlRe: tracking area problems on 10.4.11 Wesley Smith Jul 2, 20:21
mlRe: tracking area problems on 10.4.11 Michael Ash Jul 2, 20:43
mlRe: tracking area problems on 10.4.11 Wesley Smith Jul 2, 20:48
mlRE: tracking area problems on 10.4.11 Abernathy, Joshua Jul 3, 19:40
mlRe: tracking area problems on 10.4.11 John C. Randolph Jul 5, 06:14