• 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: Current mouse screen?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Current mouse screen?


  • Subject: Re: Current mouse screen?
  • From: Shaun Wexler <email@hidden>
  • Date: Sat, 17 Apr 2004 10:51:00 -0700

On Apr 17, 2004, at 10:16 AM, Ondra Cada wrote:

Anybody knows how to find the screen the mouse is currently on? The
position is easy ([NSEvent mousePosition]), but I did not succeed to
find the screen...

NSPoint mouseLoc = [NSEvent mouseLocation];
NSEnumerator *screenEnum = [[NSScreen screens] objectEnumerator];
NSScreen screen;
while ((screen = [screenEnum nextObject]) && !NSMouseInRect(mouseLoc, [screen frame], NO));

Usual disclaimers apply; written in Mail.app.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.


  • Follow-Ups:
    • Re: Current mouse screen?
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >Current mouse screen? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Using POSIX threads with Cocoa?
  • Next by Date: Moving window to a given screen?
  • Previous by thread: Current mouse screen?
  • Next by thread: Re: Current mouse screen?
  • Index(es):
    • Date
    • Thread