Re: How to find a window under the cursor
Re: How to find a window under the cursor
- Subject: Re: How to find a window under the cursor
- From: Jiri Volejnik <email@hidden>
- Date: Thu, 1 Dec 2005 21:53:11 +0100
Cybereer,
Thanks for your reply!
Why not use the -window method of NSEvent?
Because this method does not return the window under the cursor, but
the key (or the main?) window. The mouseMoved: message, for instance,
is delivered to the first responder view even when the cursor is
outside the main window, and the value returned by -window stays the
same. I need to check whether the mouse cursor is really inside my
window.
One thing to remember about tracking rectangles is that you have to
reestablish them whenever the view frame changes.
Well, I have no problems with tracking rectangles, except for this one:
Under some circumstances it does not deliver the mouseEntered: message.
The circumstances are following: There is a window with a toolbar. The
window has a main view and a "status bar" view. These views are
siblings, and they don't overlap. When I click one of the toolbar
buttons, the contents of the status bar changes (it's sub view is
replaced with another one). The main view remains untouched. If I move
the mouse down, from the toolbar to the main view, immediately after
pushing the toolbar button, and quickly enough, then the mouseEntered:
message is not delivered. If I move the mouse slowly (normally), it's
all right. The problem rises when the action involved by pushing the
button takes longer time (animated resizing of the inspector, for
example). If I don't change the contents of the status bar, everything
works fine, even when animating the inspector.
I setup tracking rectangles from within NSView's -resetCursorRects,
which is called by Cocoa whenever necessary. I can't use cursor
rectangles, however, because selecting the tool and the cursor is more
sophisticated here.
Jiri
On Dec 1, 2005, at 10:08 AM, Jiri Volejnik wrote:
Hi,
is there a way how to find a window under the cursor? Some Cocoa
equivalent for Window Manager's FindWindow(), for example?
I need it to avoid rectangle tracking, which seems not to be reliable
enough.
Thanks,
Jiri
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden