TCustomRichViewEdit.InsertText, InsertTextA, InsertTextW

TRichViewEdit

<< Click to display table of contents >>

TCustomRichViewEdit.InsertText, InsertTextA, InsertTextW

TRichViewEdit

The methods insert text at the position of caret.

procedure InsertText(const text: String;

  CaretBefore: Boolean=False);

procedure InsertTextA(const text: TRVAnsiString;

  CaretBefore: Boolean=False);

procedure InsertTextW(const text: TRVUnicodeString;

  CaretBefore: Boolean=False);

Inserted text has current text and current paragraph style.

Text may contain special characters:CR, LF, TAB, FF (#13, #10, #9, #12). #9 characters may be inserted as tabulators, depending on value of SpacesInTab property of the linked RVStyle component. #12 characters add page breaks. All possible line breaks modes (CR, LF, CR+LF, LF+CR) are supported.

InsertTextW supports the Unicode byte order marks characters (if it's present, it must be the first character in text).

If CaretBefore=True, the caret will be positioned before the inserted text after insertion (default positioning is after the text). Set it to True when performing search-and-replace in down-up direction (note: the standard replace dialog does not allow to choose down-up direction) to avoid infinite loop (when replacing, for example, 'a' with 'aa'). The "smart start" search option helps to solve this problem; however, this advice is still in effect.

Methods type: editstyle editing-style method for insertion.

unicode Unicode note:

Internally, text is stored as Unicode. InsertTextA converts ANSI to Unicode using Style.DefCodePage.

InsertText works:

like InsertTextA, in Delphi 2007 and older

like InsertTextW, in Delphi 2009 and newer

with UTF-8 string, in Lazarus

 

See also methods:

InsertStringTag, InsertStringATag, InsertStringWTag.

See also properties:

CurParaStyleNo;

CurTextStyleNo.

See also properties of TRVStyle:

TextStyles;

ParaStyles;

SpacesInTab.

See also:

Inserting items at position of caret.