Page 1 of 1

RichViewEdit->SearchText Not finding word

Posted: Thu May 23, 2013 8:26 pm
by gdenny
Hello. I am getting mixed results when searching for the same word in a richviewedit control. My code does this:

loop through a dataset and with each iteration
clear and load a richviewedit from a blob field.
richviewedit->format();
richviewedit->SetSelectionBounds(0,richviewedit(0,richviewedit->GetOffsBeforeItem(0),0,richviewedit->GetOffsBeforeItem(0));
if (richviewedit->SearchText("DIAGNOSIS:", TRVESearchOptions() <<
rvseoMatchCase << rvseoDown)) {
...do something
}

The word DIAGNOSIS: is in each of the fields but the program only finds it sometimes. I can't figure it out. Richview 11 on bcb2007. I have tried all TRVESearchOptions as well as SearchTextA and W and still cannot get a consistent return of true from the if statement. Please help. Thanks.

Posted: Thu May 23, 2013 8:51 pm
by gdenny
New information. If I search for DIAGNOSIS instead of DIAGNOSIS: it finds correctly every time. Could there be a non visible character between the S and the colon that would lead to the issue? Thanks.

Posted: Fri May 24, 2013 10:58 am
by Sergey Tkachenko
Try including rvseoMultiItem in the Options parameter.

Posted: Sun May 26, 2013 3:34 pm
by gdenny
I tried that but it gives compiler error of undefined symbol. Thanks.

Posted: Sun May 26, 2013 7:25 pm
by Sergey Tkachenko
What version of TRichView do you use?

Posted: Mon Jun 03, 2013 6:52 pm
by gdenny
RichView11

Posted: Tue Jun 04, 2013 6:24 am
by Sergey Tkachenko
This is an old version, and (as far as I remember) rvseoMultiItem was implemented later.

Without this option, SearhText searches for the substring in each text item separately. So it cannot find a substring if is a part of two or more different text items (for example, if it is written using different fonts).
I suggest to upgrade to the new version.