Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /


Chapter 2 - TextEdit

TextEdit is a collection of routines and data structures that give your application basic text formatting and editing capabilities, including text display in multiple scripts. TextEdit manages fundamental text processing tasks on text limited to 32 KB. You can use the TextEdit routines in many kinds of applications, such as spreadsheets, online (data-entry) forms, online advertising programs, simple programming-language or text-file text editors, electronic mail programs, drawing and painting programs with simple text-editing features, and electronic note cards. However, TextEdit was not designed to be used to implement word-processing applications with complex support that manipulate lengthy documents.

To use TextEdit and the information provided in this chapter, you should be familiar with the basic concepts and structures behind QuickDraw and how it handles text--particularly points, rectangles, graphics ports, fonts, and character style--the Event Manager, the Window Manager--particularly update and activate events--the Font Manager, the Script Manager, and Text Utilities.

For information on non-text features of QuickDraw, see Inside Macintosh: Imaging. For information on the Event Manager and the Window Manager, see Inside Macintosh: Macintosh Toolbox Essentials.

This book includes chapters that cover the Font Manager, Text Utilities, the Script Manager, and QuickDraw Text. Although these chapters pertain to TextEdit, the only chapter in this book that you need to read as a prerequisite to TextEdit is "Introduction to Text on the Macintosh."

This chapter describes how to use TextEdit to perform a range of editing and formatting capabilities including


Chapter Contents
About TextEdit
TextEdit and Standard Macintosh Features
Multistyled and Monostyled Text
Font and Keyboard Script Synchronization
Cutting, Copying, and Pasting Text
The TextEdit User Interface
The Selection Range, the Insertion Point, and Highlighting in TextEdit
Caret Position and Movement
Text Alignment
Line Measurement
Text Buffering
The TextEdit Private, Null, and Style Scraps
An Overview of the TextEdit Data Structures
An Overview of the Edit Record
Related Data Structures
Using TextEdit
Getting Started With TextEdit
Preparing to Use TextEdit
Displaying Static Text
Creating an Edit Record
Specifying the Destination and View Rectangles
Setting the Text of an Edit Record
Setting the Selection Range or the Insertion Point
Scrolling Text
Disposing of an Edit Record
Responding to Events Using TextEdit
Handling a Null Event
Activating an Edit Record
Handling Mouse-Down Events
Responding to an Update Event
Accepting Text Input Through Key-Down Events
Moving Text In and Out of Edit Records
Using TextEdit to Cut, Copy, and Paste Text
Inserting and Deleting Text
Text Attributes
Checking the Text Attributes Across a Selection Range
Toggling an Attribute
Handling a Font Menu
Handling a Font Size Menu
Handling a Style Menu
Changing the Text Alignment
Saving and Restoring a TextEdit Document, and Implementing Undo
Saving a TextEdit Document
Restoring an Existing TextEdit Document
Handling Undo
Customizing TextEdit
Replacing the End-of-Line Routine
Replacing the Drawing Routine
Replacing the Width-Measuring Routines
Replacing the Hit Test Routine
Customizing Word Selection
Customizing Automatic Scrolling
Determining the Line Length
Advanced Customization
TextEdit Reference
Data Structures
The Edit Record
The High Hook and Caret Hook Fields
The Style Record
The Style Table
The Line Height Table
The Null Style Record
The Style Scrap Record
The Scrap Style Table
Text Style Record
Routines
Initializing TextEdit, Creating an Edit Record, and Disposing of an Edit Record
Activating and Deactivating an Edit Record
Setting and Getting an Edit Record's Text and Character Attribute Information
Setting the Caret and Selection Range
Displaying and Scrolling Text
Managing the TextEdit Private Scrap
Checking, Setting, and Replacing Styles
Using Byte Offsets and Corresponding Points
Additional TextEdit Features
Customizing TextEdit
Summary of TextEdit
Pascal Summary
Constants
Data Types
Routines
C Summary
Constants
Types
Routines
Assembly-Language Summary
Trap Macros
Global Variables

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996