Skip to content

AppendText - DfBaseRichEdit

Appends text to end of text in control

Type: Procedure

Parameters

Parameter Type Description
sText string Text to append to control text

Syntax

Procedure AppendText string sText

Call Example

Send AppendText sText

Description

Adds text to the end of the text in the control, including RTF stream if the text in the control is an RTF stream.

This method has no effect if control is not paged.

Text can be appended as either an RTF stream or plain text, and will be converted to an RTF stream.

Use Value to set or get the entire content of the control.

Use ReplaceSel to replace text in the control.

A linefeed (LF) character can be added to text programmatically by adding ASCII character 10 to a string using the character function. A carriage return (CR) character can be added to text programmatically by adding ASCII character 13 to a string using the character function. Either a LF or CR character will break the current line in the control.

Sample

This sample adds a "This is line1", a linefeed character and "This is line 2" to the end of the text in the oRichEdit1 control.

Procedure AddToText
    string sLineFeed

    move (character(10)) to sLineFeed

    send AppendText of oRichEdit1 "This is line 1"
    send AppendText of oRichEdit1 sLineFeed
    send AppendText of oRichEdit1 "This is line 2"
End_Procedure  // AddToText

Sample

This sample adds "Some RTF text" to the end of the text in the oRichEdit1 control. The result is the same as the result of the sample above. The difference is that in this sample, sText contains an RTF stream, whereas in the sample above, sText contained plain text.

Procedure AddToText
    string sText

    move "{\rtf1\ansi\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 MS Sans Serif;}}" to sText
    move (sText + "{\colortbl ;\red0\green0\blue0;}") to sText
    move (sText + "\viewkind4\uc1\pard\cf1\lang1033\f0\fs18 Some RTF text\par}") to sText

    send AppendText of oRichEdit1 sText
End_Procedure  // AddToText