Page 1 of 1

SearchText problem in RichViewEdit

Posted: Wed Dec 07, 2005 2:08 pm
by DickBryant
I'm trying to implement search functionality in a TRichViewEdit in Delphi7. The control is IMemo and contains mixed ANSI and Unicode.

I'm calling the function

if ((MatchCase = 0) and (WholeWord = 0)) then
Found := IMemo.SearchText(EFind.Text,[])

But it does not find words that ARE in the control. In tracing the code in the RVSource code, the function exits at

if Items.Objects[strt]=item then begin
if Down then
inc(strt)
else
dec(strt);
if (strt>=Items.Count) or (strt<0) then exit;

with strt = -1. I.e. it never gets to start the search. Items.Count = 20 when the function starts. The search string, EFind.Text is 'generate'.

What am I missing here?

TIA,

Dick Bryant
Open Window Software

Posted: Wed Dec 07, 2005 2:48 pm
by Michel
Hi Dick,

I think you may be missing rvseoDown in the SrchOptions parameter, so you are starting the search from the beginning of your document backwards.

Michel

Posted: Wed Dec 07, 2005 3:49 pm
by Guest
Thanks! That makes sense. I guess I figured it would 'wrap around' and still make one pass from the end of the document backwards.