Skip to content

AppendText - DFBaseTextEdit

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.

This method has no effect if control is not paged.

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 oTextEdit1 control.

Procedure AddToText
    string sLineFeed

    move (character(10)) to sLineFeed

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

This class does not have an insert function, but we can easily add one:

Procedure Insert String sInsertText
    Integer iPos
    String sText

    Get SelStart to iPos
    Send SetSel iPos -1
    Get SelText to sText
    Move (sInsertText + sText) to sText
    Send ReplaceSel sText
End_Procedure

It can be called like this:

Procedure OnClick
    String sText

    Get Value of oInsertTextForm to sText
    Send Insert of oTextEditor sText
End_Procedure