General information
Category:
ActiveX controls in VFP
Environment versions
Network:
Windows 2003 Server
When using RTF texts, you have to be leary of using ATC() function as there may be embedding formatting codes that will interfere with the find results. Below is a sample code that I have used to set the text to search for and then execute the search:
lcFindText = GETWORDNUM(lcRtnValue,1,"|")
lnWholeWord = IIF(GETWORDNUM(lcRtnValue,2,"|")='.T.',.T.,.F.)
lnMatchCase = IIF(GETWORDNUM(lcRtnValue,3,"|")='.T.',.T.,.F.)
WITH thisform.RTFObject
DO CASE
CASE !lnWholeWord .AND. !lnMatchCase
lnFoundIndex = .Find(lcFindText,0,,0)
CASE lnWholeWord .AND. !lnMatchCase
lnFoundIndex = .Find(lcFindText,0,,2)
CASE !lnWholeWord .AND. lnMatchCase
lnFoundIndex = .Find(lcFindText,0,,4)
CASE lnWholeWord .AND. lnMatchCase
lnFoundIndex = .Find(lcFindText,0,,6)
ENDCASE
ENDWITH
IF lnFoundIndex >= 0
"Text was found"
ELSE
"Text was not found"
ENDIF
I have a search dialog that prompts for the search text, and whether to search as a whole word and if case sensitive. These are returned in the .RtnValue string that is parsed above on the | character.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only