Carbon


TXNFindProcPtr

Header: MacTextEditor.h Carbon status: Supported

typedef OSStatus(* TXNFindProcPtr) (
    const TXNMatchTextRecord *matchData, 
    TXNDataType iDataType, 
    TXNMatchOptions iMatchOptions, 
    const void *iSearchTextPtr, 
    TextEncoding encoding, 
    TXNOffset absStartOffset, 
    ByteCount searchTextLength, 
    TXNOffset *oStartMatch, 
    TXNOffset *oEndMatch, 
    Boolean *ofound, 
    UInt32 refCon
);

You would declare your function like this if you were to name it MyTXNFindCallback:

OSStatus MyTXNFindCallback (
    const TXNMatchTextRecord *matchData, 
    TXNDataType iDataType, 
    TXNMatchOptions iMatchOptions, 
    const void *iSearchTextPtr, 
    TextEncoding encoding, 
    TXNOffset absStartOffset, 
    ByteCount searchTextLength, 
    TXNOffset *oStartMatch, 
    TXNOffset *oEndMatch, 
    Boolean *ofound, 
    UInt32 refCon
);
Parameter descriptions
matchData

A pointer to a TXNMatchTextRecord structure containing the text to match, the length of that text, and the text’s encoding. Pass NULL if you are looking for a graphics, sound, or movie object.

iDataType

A “Supported Data Types” value of type TXNDataType. If the data type is ‘PICT’, ‘moov’, or ‘snd’, the default behavior is to match on any non-text object. You can customize your callback to find a specific data type or ignore types that do not match what you want to find.

iMatchOptions

A “Search Criteria Masks” value of type TXNMatchOptions. This specifies the matching rules to use in the find operation.

iSearchTextPtr

A pointer to the text you want to search.

encoding

A variable of type TextEncoding that specifies the encoding of the text you want to search.

absStartOffset

A variable of type TXNOffset. This specifies the offset at which a search should begin. The constant kTXNStartOffset specifies the start of the object’s data.

searchTextLength

A variable of type ByteCount that specifies the length, in bytes, of the text you want to search.

oStartMatch

An unsigned 32-bit integer your application can use as needed.

oEndMatch

A pointer to a variable of type TXNOffset. On return, it specifies the absolute offset to the start of the match. It is set to 0xFFFFFFFF if there is no match.

ofound

A pointer to a variable of type TXNOffset. On return, it specifies the absolute offset to the end of the match. It is set to 0xFFFFFFFF if there is no match.

refCon

A pointer to a Boolean value. On return, ofound is true if a match is found.

function result

A result code.

DISCUSSION

You pass a pointer to your find callback function as a parameter to the TXNFind function. To provide a pointer to your find callback function, you create a universal procedure pointer (UPP) of type TXNFindUPP, using the NewTXNFindUPP function. You can do so with code like the following:

TXNFindUPP MyTXNFindUPP;

MyTXNFindUPP = NewTXNFindUPP (&MyFindCallback);

If you wish to call your find callback function directly, you can use the InvokeTXNFindUPP function.

When you are finished with your find callback function, you should use the DisposeTXNFindUPP function to dispose of the universal procedure pointer associated with it. However, if you plan to use the same find callback function in subsequent calls to the TXNFind function, you can reuse the same UPP, rather than dispose of it and later create a new UPP.

VERSION NOTES

Supported in Carbon.


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