• 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: Converting HIPoints to CGPoints/NSPoints in global space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting HIPoints to CGPoints/NSPoints in global space?


  • Subject: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • From: Dave MacLachlan <email@hidden>
  • Date: Tue, 14 Feb 2006 08:48:56 -0800

Thanks Raleigh...

However, this is not always the case. Global carbon HIPoint mouse coordinates are origin upper left. You must know the source of the HIPoint to make any judgement on it.

I'm working in global space.


Why are you looping through all the displays? The only one that matters is the one with the menu bar. If you want to go from Carbon global space to Cocoa global space, the the bottom left of the screen with the menu bar is your origin. Use that screen's height in your calculation.

I wasn't sure that this was the case (and when I was coding the original version it was on my Powerbook with no external screens to test on. Now that I've had some time to play, this problem isn't as tough as I thought it may be.


Short answer:

Get the menu screen height
HIPoint.x == CGPoint.x
HIPoint.y == menu screen height - CGPoint.y

Done!

Cheers,
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


References: 
 >Re: Converting HIPoints to CGPoints/NSPoints in global space? (From: Raleigh Ledet <email@hidden>)

  • Prev by Date: NSAttributedString
  • Next by Date: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Previous by thread: Re: Converting HIPoints to CGPoints/NSPoints in global space?
  • Next by thread: ObjC procedure vs C procedure within Cocoa
  • Index(es):
    • Date
    • Thread