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 Reference
Routines / Displaying and Scrolling Text


TECalText

The TECalText procedure recalculates the beginnings of all lines of text in the specified edit record.

PROCEDURE TECalText (hTE: TEHandle);
hTE
A handle to the edit record whose text lines are to be recalculated.
DESCRIPTION
The TECalText procedure updates elements of the lineStarts array in an edit record. Call TECalText if you've changed the destination rectangle, the hText field, or any other property of the edit record that pertains to line breaks and the number of characters per line--for example, font, size, style, and so on.

ASSEMBLY-LANGUAGE INFORMATION
The low-memory global variable TERecal contains the address of the routine called by TECalText to recalculate the line starts and set the first and last characters that need to be redrawn. The TERecal default hook routine calls the Text Utilities StyledLineBreak function. If you replace the default TERecal hook routine with a customized version and your application supports non-Roman script systems, make sure that your customized hook routine is script-aware. The registers on entry and exit for this hook routine are:
Registers on entry
A3Pointer to the locked edit record
D7Change in the length of the record (word)
Registers on exit
D2Line start of the line containing the first character to be redrawn (word)
D4Position of last character to be redrawn (word)

TextEdit uses the low-memory global variable WordRedraw widely, but primarily for line calculations and to determine how much of a line to redraw after the user types in a character. TextEdit sets the correct value for WordRedraw in TEInit based upon the installed script systems. If a 2-byte script is installed, TEInit performs an OR operation on WordRedraw with a 1; if a right-to-left script is installed, TEInit performs an OR operation on WordRedraw with an $FF. The size of this global is one byte.

TextEdit interprets the final value of WordRedraw as follows:
ValueDescription
0Redraws the character before the entered character.
1Redraws the word before the entered character.
$FFRedraws the whole line.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996