Skip navigation.
 
mlCalculating Desktop Icon Positions
FROM : dave miller
DATE : Wed Jun 14 17:43:35 2006

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

Related mailsAuthorDate
mlCalculating Desktop Icon Positions dave miller Jun 14, 17:43
mlRe: Calculating Desktop Icon Positions Justin R. Miller Jun 14, 18:01
mlRe: Calculating Desktop Icon Positions Uli Kusterer Jun 14, 19:07