• 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
Calculating Desktop Icon Positions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculating Desktop Icon Positions


  • Subject: Calculating Desktop Icon Positions
  • From: dave miller <email@hidden>
  • Date: Wed, 14 Jun 2006 09:43:35 -0600

So I've stumbled across a little snag that I don't have the wherewithal to work around...

I'm tinkering away on a little utility that interacts with the icons on your desktop. In doing so, I need to know their locations and how they relate to the window(s) of my application. In the worst-case scenario I can use AppleScript to retrieve a list of all the desktop items, get their desktop position property, and do my mumbo jumbo from there. Snag #1 is that AppleScript seems to use the upper left corner of the display as the origin, where as Cocoa treats the bottom left corner of the display as the origin. This can be fixed easily enough by calculating the size of the display and doing a little bit of arithmetic. But how does one go about calculating the size of the display?

And this will only work for cases where *one* monitor is connected. How would you go about doing this when multiple monitors are connected? I know the NSScreen class can return an array containing information about the displays, but how one goes about correlating the window position and the desktop icons to see if they match is beyond me. This all depends on how the displays are positioned relative to each other in System Preferences, etc.

Any pointers and/or help would be greatly appreciated.

Dave
_______________________________________________
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: Calculating Desktop Icon Positions
      • From: Uli Kusterer <email@hidden>
    • Re: Calculating Desktop Icon Positions
      • From: "Justin R. Miller" <email@hidden>
  • Prev by Date: Re: Mouse Events & NSResponder
  • Next by Date: AppleEvent handlers don't seem to work.
  • Previous by thread: PopupMenu takes two clicks to release (Solution)
  • Next by thread: Re: Calculating Desktop Icon Positions
  • Index(es):
    • Date
    • Thread