Skip to content

Value - DfBaseRichEdit

Sets or returns content of control

Type: Property
Access: Read/Write
Data Type: string
Parameters: None

Parameters

Parameter Type Description
iItem Integer

Syntax

Property string Value
Access Type Syntax
Read Access: Get Value to stringVariable
Write Access: Set Value to stringVariable/Value

Description

Sets or gets the entire contents of the control, including RTF stream if the text in the control is an RTF stream. You can also use paValue to get and set the contents of control from or to a memory address.

When placing the content of the control into a variable, the full RTF stream of the control is placed into that variable (rather than just the text). When setting the content of the control, it can be set from either an RTF stream or plain text, and will be converted to an RTF stream.

Use AppendText to append text to the end of the text in the control. CharCount returns length of RTF stream 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 sets the contents of the oRichEdit1 control to "This is line 1", then a line break, then "This is line 2".

Procedure DisplayText
    string sText sLineFeed

    move (character(10)) to sLineFeed
    move ("This is line 1" + sLineFeed + "This is line 2") to sText

    set Value of oRichEdit1 to sText
End_Procedure  // DisplayText

Sample

This sample also sets the contents of the oRichEdit1 control to "Some RTF text". 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 DisplayText
    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

    set Value of oRichEdit1 to sText
End_Procedure  // DisplayText