TCustomRichView.OnTextFound

<< Click to display table of contents >>

TCustomRichView.OnTextFound

Occurs when TRichView.SearchText (or TRichViewEdit.SearchText) finds a text.

type
  TRVTextFoundEvent = procedure(Sender: TCustomRichView;
    const AText: TRVUnicodeString; ARVData: TCustomRVData;
    StartItemNo, StartItemOffs, EndItemNo, EndItemOffs: Integer;
    Invert: Boolean; var DoDefault: Boolean) of object;
 
property OnTextFound: TRVTextFoundEvent;

(introduced in version 19)

Parameters:

AText text that was searched for.

ARVData document containing this text; it can be Sender.RVData, a table cell, or RVData of an cell inplace-editor.

StartItemNo, StartItemOffs, EndItemNo, EndItemOffs define text position in ARVData. StartItemNo and StartItemOffs define the starting position (closer to the beginning of the document), EndItemNo and EndItemOffs define the ending position (closer to the end of the document). StartItemNo and EndItemNo are indexes of items of ARVData, StartItemOffs and EndItemOffs are positions in these items (see GetSelectionBounds for additional information).

If Invert = False, the text should be selected from start to end. If Invert = False, the text should be selected from end to start (when searching backward)

If you leave DoDefault = True, the text will be selected. If you assign False, nothing will be done (but still SearchText will return True); in this case you can call StoreSearchResult to store the found position (to continue search from it).

 

Possible applications for this event:

Searching in unformatted documents. Sometimes you just need to know if a document contains the specified text. A selection requires a formatted document; so, if you forbid selection, you can search in unformatted text. This is especially useful for searching in multiple documents.

Searching in TRVReportHelper.RichView

Implementing additional search conditions that you can verify in this event. For example, you can search only in text that has specific attributes.