• 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: Coordinate Systems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coordinate Systems


  • Subject: Re: Coordinate Systems
  • From: Brock Brandenberg <email@hidden>
  • Date: Thu, 10 Oct 2002 08:57:05 -0500

Hi Tom.

> Here's the question... it seems characterIndexForPoint requires a
> "screen" coordinate and locationInWindow returns a "window centric
> coordinate", so, do I need to convert my "window centric coordinate" to
> a "screen" coordinate for this method to work for me?
>
> Anybody know why this method requires a screen coordinate and not a
> window coordinate?

Reinforcing Jerome's response, the a text container (part of the
NSTextStorage/NSTextContainer/NSLayoutManager/NSTextView hierarchy) has its
origin at the top left even though the window has its origin at the bottom
left. This is because nearly all text systems run top-down, so this is the
most logical origin for the container. Some interface objects are/can be
oriented like this, so you just need to be aware of them and ready to
convert coordinates when necessary.

Read about text containers in the Text Handling section of the Cocoa docs
and you'll see how the NSLayoutManager handles coordinates and layout inside
text containers.

Brock Brandenberg

----- industrial design @ www.bergdesign.com ------
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: New to Cocoa
  • Next by Date: Re: Carbon vs Cocoa arguments
  • Previous by thread: Re: Coordinate Systems
  • Next by thread: Launch App with drag and drop
  • Index(es):
    • Date
    • Thread