How to implement Find and Replace dialogs

<< Click to display table of contents >>

How to implement Find and Replace dialogs

Find

The key method is TRichView.SearchText or TRichViewEdit.SearchText.

Search can be case sensitive or not, up or down. "Whole word" option is also supported.

You can convert options from Find dialog to SrchOptions parameter of these methods using GetRVSearchOptions or GetRVESearchOptions.

Replace

Use TRichViewEdit.SearchText to select the old string.

Then use InsertText to replace it with the new one. This method removes the selected part of document before performing insertion. If you search in backward direction, set CaretBefore parameter to True.

Examples

Demos:

Find dialog is implemented in the main editor demo:

Demos\*\Editors\Editor 1\

Both Find and Replace dialogs are implemented in the demo:

Demos\*\Assorted\Search and Replace\

Alternatively, you can use RichViewActions.