• 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: Finder window - coordinates and screen?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder window - coordinates and screen?


  • Subject: Re: Finder window - coordinates and screen?
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 25 Jun 2007 23:50:40 +0200

On 25.06.2007, at 19:19, Finlay Dobbie wrote:
I can't say I know offhand. You'll probably get a string back from
AppleScript, you'll probably want to parse that into a few floating
point numbers, then do the usual jiggery pokery to translate the
coordinate bases.

The origin is on NSScreen #0, i.e. the first screen on the screens array, which is the one that holds the menu bar. AppleScript uses flipped coordinates, which have 0,0 at the upper left, with the Y axis going down. To convert the coordinates, you'll have to calculate the enclosing rectangle of all screens.


After that, you just do a little add/subtract dance with the Y coordinate of whatever you want to convert. First subtract the height of screen #0 from the Y coordinate, and then subtract it from the height of the rect containing all screens, or something like that. I usually draw myself a little picture, and then it becomes obvious again...

Cheers,
-- M. Uli Kusterer
http://www.zathras.de



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Finder window - coordinates and screen? (From: b UND d <email@hidden>)
 >Re: Finder window - coordinates and screen? (From: "Finlay Dobbie" <email@hidden>)

  • Prev by Date: [SOLVED] NSTextView contained in a bezier-path
  • Next by Date: Re: Adding files to iTune library in Cocoa app
  • Previous by thread: Re: Finder window - coordinates and screen?
  • Next by thread: AppleScript not sending my Cocoa app proper floats on Intel
  • Index(es):
    • Date
    • Thread