Information générale
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
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.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement