• 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
Co-ordinate conversion question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Co-ordinate conversion question


  • Subject: Co-ordinate conversion question
  • From: "Christian Graus" <email@hidden>
  • Date: Sat, 29 Nov 2008 16:31:23 +1030

OK, I managed to find the answer to my main question on google ( not for
want of trying previously ).

NSPoint pt = [NSEvent mouseLocation];

 NSRect rcTV = [tableView bounds];


 pt = [tableView convertPoint:pt fromView:nil];

So, now the first line gives me the mouse position on the screen.  The
second gives me the bounds of my control, because the co-ordinates are right
to left, so I assume I need to work out the width of the control b/c I want
to know if the mouse is within the first 16 pixels of the item, from the
left.  Finally, I am trying to turn my screen relative point into a point
relative to the table view.  Nothing I've tried in this regard, is doing
anything that resembles what I expect ( an x value between 0 and the width
of the control ).  how do I do that?

Thanks as always

Christian
_______________________________________________

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

  • Follow-Ups:
    • Re: Co-ordinate conversion question
      • From: Rob Keniger <email@hidden>
  • Prev by Date: Re: Checking One Array Against Another
  • Next by Date: Re: Still unable to work out mouse position
  • Previous by thread: Re: Still unable to work out mouse position
  • Next by thread: Re: Co-ordinate conversion question
  • Index(es):
    • Date
    • Thread