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 / Using Byte Offsets and Corresponding Points


TEGetPoint

The TEGetPoint function determines the point that corresponds to the specified byte offset of a character and returns the coordinates of that point.

FUNCTION TEGetPoint (offset: Integer; hTE: TEHandle): Point;
offset
A byte offset into the text buffer of an edit record.
hTE
A handle to the edit record containing the text.
DESCRIPTION
The TEGetPoint function returns a valid result even when the edit record does not contain any text. The point returned is based on the values in the record's destination rectangle. In the case of an offset being equal to a line end, which is also the start of the next line, TEGetPoint returns a point corresponding to the line start of the next line. In the case of a dual caret, the primary caret position, the one corresponding to the primary line direction, is returned.

The line height, taken either from the lineHeight field for a monostyled edit record or from the line-height array, LHElement, for a multistyled edit record, is also used to determine the vertical component. Both the text direction and the primary line direction are used to determine the horizontal component.

The TEGetPoint function works for both monostyled and multistyled edit records.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996