Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searching for text in a RichTextControl
Message
De
14/07/2005 09:43:26
 
 
À
14/07/2005 05:40:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01032533
Message ID:
01032606
Vues:
19
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
Fil
Voir

Click here to load this message in the networking platform