Skip navigation.
 
mlRe: tracking area problems on 10.4.11
FROM : Tony Becker
DATE : Wed Jul 02 19:21:42 2008

As a general rule, the tracking rects are smaller then the whole 
window, and technically need the mouse to enter/exit, which I don't 
see happening, if they are the same size.

Try something like:
   [[mWindow contentView] addTrackingRect:NSInsetRect([mWindow frame], 
[mWindow frame].size.width/4.0, [mWindow frame].size.height/4.0)
                   owner:self
                   ...

Which will create a tracking rect 1/2 the size of the window, centered.
The owner is the one who gets the callback, which is your class.

On Jul 1, 2008, at 5:29 PM, Wesley Smith 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]
>                             owner:[mWindow contentView]
>                             userData:nil
>                             assumeInside:NO];
>
> I've also tried:
> [[mWindow contentView] addTrackingRect:[mWindow frame]
>                             owner:mWindow
>                             userData:nil
>                             assumeInside:NO];
>
> mWindow is a custom NSWindow and the content view attached is also a
> custom NSView.  I've defined the above event handlers in both custom
> classes and set breakpoints, print messages, etc. but despite who I
> set as owner of the tracking rect, I can't get the events to trigger.
> Is there something else I have to do?
>
> thanks,
> wes
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>

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