Carbon


TXNGetData

Header: MacTextEditor.h Carbon status: Supported

Copies a range of data.

OSStatus TXNGetData (
    TXNObject iTXNObject, 
    TXNOffset iStartOffset, 
    TXNOffset iEndOffset, 
    Handle *oDataHandle
);
Parameter descriptions
iTXNObject

A variable of type TXNObject. Pass the text object that contains the data you want to copy.

iStartOffset

A variable of type TXNOffset. You should specify the absolute offset from which data copying should begin. Make sure iStartOffset and iEndOffset do not specify a range that includes text and non-text data (that is, crosses a data type boundary). You can use the TXNGetSelection function to get the absolute offsets of the current selection.

iEndOffset

A variable of type TXNOffset. You should specify the absolute offset at which data copying should end. You can use the function TXNGetSelection to get the absolute offsets of the current selection.

oDataHandle

A pointer to a handle. On return, the handle points to the requested data. TXNGetData allocates the handle as necessary. Your application must dispose the handle.

function result

A result code.

DISCUSSION

You first need to use the TXNCountRunsInRange function to find the number of data runs in a given range. Then you can examine each run’s type and text attributes with the TXNGetIndexedRunInfoFromRange function. Finally, use the TXNGetData function to examine data for each run of interest to you. The function does not check to see that the copied data aligns on a word boundary; data is simply copied as specified in the offset values.

The iStartOffset and iEndOffset parameters can specify a range that crosses a style run boundary but not a range that crosses a data type boundary (that is, includes text and non-text data). If the range includes text and non-text data, the TXNGetData function returns the error code kTXNIllegalToCrossDataBoundariesErr.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)