I am using TXFind of MLTE for finding the text hello from TXNObject.
If it finds the text I want to display Message Find.For that I have
written TXNFindPrc But It is not working eventhough word "hello" is
there.
Follwing is the code.
Pls suggest where I am wrong?
LMLTEPane *mltPane;
mltPane=dynamic_cast<LMLTEPane*>(theWindow->FindPaneByID(200));
TXNObject txnobj;
txnobj=mltPane->GetTextObject();
OSStatus stat;
TXNOffset * oStartMatchOffset=new TXNOffset;
TXNOffset * oEndMatchOffset=new TXNOffset;
TXNMatchTextRecord *record=new TXNMatchTextRecord;
const char* text="hello";
record->iTextPtr=text;
TXNFindUPP MyTXNFindUPP;
MyTXNFindUPP = NewTXNFindUPP (&MyFindCallback) ;
record->iTextToMatchLength=strlen(text);
record-> iTextEncoding=kTXNSystemDefaultEncoding;
TXNDataType type = kTXNTextData;
stat=TXNFind(txnobj,record,kTXNTextData,kTXNEntireWordMask
,kTXNStartOffset,kTXNEndOffset,MyTXNFindUPP,NULL,oStartMatchOffset,oEndMatchOffset);
////// Find Proc is as shown below
pascal OSStatus MyFindCallback (
const
TXNMatchTextRecord * matchData,
TXNDataType
iDataType,
TXNMatchOptions iMatchOptions,
const void * iSearchTextPtr,
TextEncoding encoding,
TXNOffset absStartOffset,
ByteCount searchTextLength,
TXNOffset * oStartMatch,
TXNOffset * oEndMatch,
Boolean * ofound,
UInt32 refCon
)
{
StandardAlert(2,"\p Word Found",NULL,NULL,0);
}
////
-Hemant


|