rvico TRichView Reference | TRichViewEdit

TCustomRichViewEdit.SearchText, SearchTextW

Top  Previous  Next

The methods search for the substring s in the document.

function SearchText(s: String; SrchOptions: TRVESearchOptions): Boolean;

function SearchTextW(s: WideString; SrchOptions: TRVESearchOptions): Boolean;

When found, these methods select substring and move the caret to the end of selection.

 

The methods start searching from the caret position, up or down depending on SrchOptions.

Limitation: The methods search the substring in all text items separately.

unicode Unicode note: The methods allow searching both in ANSI and in Unicode text items. When SearchText compares Unicode text with s, the conversion is based on RVStyle.DefCodePage. When SearchTextW compares ANSI text with s, the conversion is based on the character set of the text style.

These methods can be used for search-and-replace operation as well. SearchText/SearchTextW selects the found string, InsertText/InsertTextW replaces it with the new one. See important note about search and replace in down-up direction in the topic about InsertText.

History and compatibility

Since version 1.2 SearchText can search upwards.

Since version 1.5 SearchText can search whole words (substring must be delimited with characters from Delimiters)

SearchTextW is introduced in version 10.

Note: There is incompatibility with programs written with the older version of RichView (1.0 1.1.4). Now if rvsroDown is not included in SrchOptions, the methods search upwards. In the older versions there was no rvsroDown option, and SearchText searched downwards only.

 

These methods must be called only when the document is formatted.

 

Return value:

Is the substring found?

 

See also:

TRichView.SearchText, SearchTextW;
GetRVESearchOptions global function;
Searching in RichView and RichViewEdit.


RichView © Sergey Tkachenko