• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to find a window under the cursor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Sat, 3 Dec 2005 02:36:12 +0100

On Dec 2, 2005, at 16:48, Cybereer wrote:

Actually, I did mean mouseEntered that should be called for both foreground and background apps, not mouseMoved that only works when your app is active.
However, there seems to be a bug (at least in Tiger), so that mouseEntered never gets called regardless. The workaround is to override -sendEvent: of NSApplication and track NSMouseEnterd there.

As far as I can understand the documentation, if one wants mouseEntered to be sent to the view, he has to set tracking rectangle properly, and the view has to be the first responder in the key window.

Anyway, thank you very much for the tip with overriding NSApplication's sendEvent, it seems it can probably help me!

Still I wonder if there is a way how to find a window under the cursor in Cocoa. Nobody knows?

Regards,
Jiri


On Dec 1, 2005, at 6:00 PM, Jiri Volejnik wrote:

On Dec 1, 2005, at 22:31, Cybereer wrote:

Are you trying to find windows of other apps?
No, I don't.

If true, you could do a hit test for all onscreen windows. For windows of your own app, all you have to do is to call setAcceptsMouseMovedEvents and track the mouse enter by overriding -mouseEntered: method which works for background window.

You probably mean -mouseMoved:, not mouseEntered: message.

Tracking mouseMoved events works fine for me, there is no problem. But it tells me nothing about the window under the cursor! Events passed to mouseMoved: method contain a pointer to the main window, not the window under the cursor, as I already mentioned. If you move the cursor out of your window, or if you move it to another window of your app, by sending -window to the event you still get only a pointer to the main window! The message hitTest: works well, but one have to send it to the view of the right window, otherwise he can easily get nonsense, as the window may be overlapped by a floating panel, for example.

Regards,
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
  • Follow-Ups:
    • Re: How to find a window under the cursor
      • From: Manfred Schwind <email@hidden>
References: 
 >How to find a window under the cursor (From: Jiri Volejnik <email@hidden>)
 >Re: How to find a window under the cursor (From: Cybereer <email@hidden>)
 >Re: How to find a window under the cursor (From: Jiri Volejnik <email@hidden>)
 >Re: How to find a window under the cursor (From: Cybereer <email@hidden>)
 >Re: How to find a window under the cursor (From: Jiri Volejnik <email@hidden>)
 >Re: How to find a window under the cursor (From: Cybereer <email@hidden>)

  • Prev by Date: binding to a controller not in my nib, how?
  • Next by Date: Re: binding to a controller not in my nib, how?
  • Previous by thread: Re: How to find a window under the cursor
  • Next by thread: Re: How to find a window under the cursor
  • Index(es):
    • Date
    • Thread