Re: unespected behavior of some NSWindow, NSView methods
Re: unespected behavior of some NSWindow, NSView methods
- Subject: Re: unespected behavior of some NSWindow, NSView methods
- From: Matthew Formica <email@hidden>
- Date: Wed, 12 Dec 2001 10:38:48 -0800
Andrea,
I can speak to the first issue, but not the second. Tracking rects are
currently broken on Mac OS X, and can easily get out of sync in the first
couple in/out cycles (although they end up being right over time). Probably
the best way to get proper mouse tracking right now is to do it yourself
manually with mouseMoved events. This issue is currently bug #2707850, and
should be fixed in the next major release of Mac OS X.
Regards,
- Matthew
--
Matthew Formica
DTS Engineer - Developer Tools and Cocoa
Apple Computer, Inc.
email@hidden
Mac OS X Development Tools:
http://developer.apple.com/tools/
Project Builder on the web:
http://developer.apple.com/tools/projectbuilder/
Project Builder FAQ:
http://developer.apple.com/tools/projectbuilder/faq.html
Cocoa docs on the web:
http://developer.apple.com/techpubs/macosx/Cocoa/CocoaTopics.html
Cocoa sample code:
http://developer.apple.com/samplecode/Sample_Code/Cocoa.htm
On 12/12/01 7:54 AM, "Andrea Perego" <email@hidden> wrote:
>
Dear fellow developers,
>
>
I'd like to tell you about a couple of strange thing that I found
>
while playing with NSWindow and NSView:
>
>
A- NSWiew's
>
>
- (NSTrackingRectTag)addTrackingRect:(NSRect)aRect owner:(id)anObject
>
userData:(void *)userData assumeInside:(BOOL)flag
>
>
I've set up a tracking rect to do some things when the mouse enters
>
my custom view and its window is the main window. In some cases the
>
mouse is already within the view when the rect is created (e.g. if
>
you send a window to the dock, then click its icon and move the mouse
>
to a point within the region previously occupied by the window,
>
preceding the "genie" effect). By reading the method info:
>
>
" flag determines which event is sent first by indicating where the
>
mouse is assumed to be at the time this method is invoked. If flag is
>
YES, the first event will be generated when the mouse leaves aRect;
>
if flag is NO the first event will be generated when the mouse enters
>
it. "
>
>
I guessed I had to pass "assumeInside: YES" in those cases.
>
Well, doing so seems to cause a very strange behavior; namely
>
- you move the mouse outside and "mouseExited" is sent (OK!)
>
- you move the mouse inside: no "mouseEntered" (???)
>
- you move the mouse outside and and "mouseExited" is sent again
>
from now on, everything works as one would expect.
>
Two consecutive "mouseExited" events are very puzzling, IMHO; I've tested
>
that, perchance, I hadn't *two* track rects instead of just one, by
>
checking the rect tag.
>
Pragmatically, I've changed the code to issue always "assumeInside:
>
NO" and everything seems to work fine, but I'd like to know where I
>
was wrong in my previous conception.