Important: The information in this document is obsolete and should not be used for new development.
Using TextEdit
This section describes how to initialize TextEdit and use the TextEdit routines and data structures to display text and implement editing features in an application. It also describes how to customize the behavior of TextEdit, for example, to better suit the requirements of your application and the script systems it supports.
This section includes sample application-defined routines and code fragments that show some of the ways you can use TextEdit. These examples are provided for illustrative purposes only; they are not meant to be used in applications you write.
- "Getting Started With TextEdit" describes how to display static text in a box, create an edit record for modifiable text, set the text of an edit record and scroll it, set its insertion point, and dispose of the edit record.
- "Responding to Events Using TextEdit" describes how to handle mouse-down, key-down, and idle events.
- "Moving Text In and Out of Edit Records" describes how to cut, copy, and paste text and its character attributes within or across applications, or between an application and a desk accessory.
- "Text Attributes" describes how your application can check the current attributes of a range of text to determine which ones are consistent across the text. It also describes how you can manipulate the font, style, size, and color of a range of text.
- "Saving and Restoring a TextEdit Document, and Implementing Undo" describes how to save to disk the contents of a document created using TextEdit, and restore it when the user opens the document.
- "Customizing TextEdit" describes how to replace the default end-of-line, drawing, width-measuring, and hit test hook routines, use the multi-purpose low-memory global variable
TEDOText
hook routine, customize word selection and automatic scrolling, and determine the length of a line of text.
- Note
- For both monostyled and multistyled edit records, the text is limited to 32 KB. Whenever you insert or paste text, you need to ensure that adding the new text does not exceed the 32 KB limit. Your application can check for this limit before you insert or paste text.
Subtopics
- Getting Started With TextEdit
- Responding to Events Using TextEdit
- Moving Text In and Out of Edit Records
- Text Attributes
- Saving and Restoring a TextEdit Document, and Implementing Undo
- Customizing TextEdit