RichViewEdit->SearchText Not finding word

General TRichView support forum. Please post your questions here
Post Reply
gdenny
Posts: 28
Joined: Wed Jul 22, 2009 6:46 pm

RichViewEdit->SearchText Not finding word

Post 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.
gdenny
Posts: 28
Joined: Wed Jul 22, 2009 6:46 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Try including rvseoMultiItem in the Options parameter.
gdenny
Posts: 28
Joined: Wed Jul 22, 2009 6:46 pm

Post by gdenny »

I tried that but it gives compiler error of undefined symbol. Thanks.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

What version of TRichView do you use?
gdenny
Posts: 28
Joined: Wed Jul 22, 2009 6:46 pm

Post by gdenny »

RichView11
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply