Mac OS X Reference Library Apple Developer
Search

LayoutManagerDemo

Last Revision:
Version 1.0, 2003-01-14
Demonstrates the layout manager using rollovers with different colors for lines, words and characters under the mouse.
Build Requirements:
Runtime Requirements:
Mac OS X Mac OS X, Project Builder 2.0 or later (project file can be downgraded)

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




Last updated: 2003-01-14

Did this document help you? Yes It's good, but... Not helpful...