Version: 1.0

Posted: 2003-01-14

Build Requirements: N/A

Runtime Requirements: Mac OS X Mac OS X, Project Builder 2.0 or later (project file can be downgraded)

View Source Code:

Download Sample (“LayoutManagerDemo.zip”, 30.8K)
Download Sample (“LayoutManagerDemo.dmg”, 82.0K)



Description

This application demonstrates interrogating the layout manager for information about text layout, and the use of temporary attributes to color text. Specifically, we provide rollover coloring of text--one color for the line, another for the word, and a third for the character under the mouse. A subclass of NSTextView is used, but solely for the purpose of obtaining mouse events. The interesting portion of the code involves the conversion of mouse coordinates to a particular glyph and character index, then determining the corresponding line and word, and finally using temporary attributes for coloring. Requirements: Mac OS X, Project Builder 2.0 or later (project file can be downgraded) Keywords: NSLayoutManager cocoa text nslayoutmanager

Document Revision History

Date Notes
2003-01-14Demonstrates the layout manager using rollovers with different colors for lines, words and characters under the mouse.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.