Re: Properly handling mouseEntered: events
Re: Properly handling mouseEntered: events
- Subject: Re: Properly handling mouseEntered: events
- From: Greg Titus <email@hidden>
- Date: Wed, 25 Jun 2003 09:18:57 -0700
On Wednesday, June 25, 2003, at 08:35 AM, Henry McGilton wrote:
I discovered the hard way that you have to add the tracking
rectangle(s)
in the code that creates the view --- that is, outside of the view's
code.
[...]
I had previously thought to add the tracking rectangle in the
initWithFrame method of the view that was being created, but
discovered that that did not work.
Tracking rectangles are handled by windows, so the view needs to be
added to a window before tracking rects will work. A good way to do
this in the view's own code is by implementing NSView's
-viewDidMoveToWindow method to add your rects.
Additionally, make sure you keep the tracking rectangle tag
around, because if you move the view within its superview, you
must remove the tracking rectangle and re-instate it.
The place to do this is by implementing -resetCursorRects. This method
could be better named, but a cursor rect is just a more specific
implementation of a tracking rect, and they need to be reset at the
same times.
Hope this helps,
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.