Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching for text in a RichTextControl
Message
From
14/07/2005 09:43:26
 
 
To
14/07/2005 05:40:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01032533
Message ID:
01032606
Views:
18
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
Map
View

Click here to load this message in the networking platform