• 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: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question


  • Subject: Re: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
  • From: Graham Cox <email@hidden>
  • Date: Wed, 12 May 2010 15:01:36 +1000

On 12/05/2010, at 2:51 PM, aaron smith wrote:

> To me the first "localPoint = ..." should be the correct way to
> convert the windowPoint to the control views' coordinate space. But
> it's never right.
>
> Any ideas?

> localPoint = [[self controlView] convertPoint:windowPoint toView:nil];


You're working way too hard. Also, your first localPoint= is exactly the wrong way around. It should be:


NSPoint localPoint = [controlView convertPoint:[event locationInWindow] fromView:nil];

that should be all you need to do. As I understand it, a cell's -controlView method might not return the control view reliably, so you are better off using the view passed to the method as a parameter.

All that convertScreenToBase stuff you're doing is superfluous AFAICS.

--Graham


_______________________________________________

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: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
      • From: Graham Cox <email@hidden>
    • Re: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
      • From: Jack Carbaugh <email@hidden>
References: 
 >Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question (From: aaron smith <email@hidden>)

  • Prev by Date: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
  • Next by Date: Re: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
  • Previous by thread: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
  • Next by thread: Re: Point Conversion Between Coordinate Spaces. Working with NSControl and NSCell. Quick Question
  • Index(es):
    • Date
    • Thread