Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get a kEventMouseExited at the edge of a window



That will work, but it will be a firehose of events :)

On Mar 9, 2007, at 10:49 AM, Matthew Douglass wrote:

So why is it inevitable that I always send these emails and then have a brainstorm.  I realized I could catch kEventMouseMoved at the application level and then just check if kEventParamWindowRef is my window or not.

Sorry for the noise,

Matthew

 

From: carbon-dev-bounces+mdouglass=email@hidden [mailto:carbon-dev-bounces+mdouglass=email@hidden] On Behalf Of Matthew Douglass
Sent: Friday, March 09, 2007 10:36 AM
To: email@hidden
Subject: How to get a kEventMouseExited at the edge of a window

 

kEventWindowCursorChange

 

Hey all,

 

First a word of warning, though I’ve been programming for Windows for quite some time, I’m very new to OS X.  So if my question is obvious, I apologize.

 

My goal is to get a notification when the mouse leaves my window content region (in 10.3+).  I saw kEventMouseExited and decided to try to use that.  I added a call to CreateMouseTrackingRegion, passing in the region returned by GetWindowRegion(kWindowContentRegion) and kMouseTrackingOptionsGlobalClip.  But even after realizing I needed to call SetMouseTrackingRegionEnabled(true), I still never get any events. 

 

As an experiment, I created a Rect slightly smaller than the size of my window (about 10 pixels on each side) and passed that in to CreateMouseTrackingRegion with kMouseTrackingOptionsLocalClip.  After doing that I started to get kEventMouseExited events.  However, I noticed that if I moved the mouse very quickly (fast enough that I don’t get mouse moved events inside that 10 pixel boundary), then I don’t get kEventMouseExited. 

 

As another failed experiment (based on something I saw in google) I tried catching kEventWindowCursorChange in my application event handler, but that too didn’t catch mouse moves that weren’t over my window.

 

So I need some way to get a notification when the mouse is leaving the content region of my window – what other options are there?

 

Thanks,

Matthew

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >How to get a kEventMouseExited at the edge of a window (From: "Matthew Douglass" <email@hidden>)
 >RE: How to get a kEventMouseExited at the edge of a window (From: "Matthew Douglass" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.