Help Center

CRichEdit.SetTextModemethod

Sets the text mode or undo level of a rich edit control.

Windowsmethoddocumented

Syntax

FUNCTION SetTextMode (BYVAL hRichEdit AS HWND, BYVAL pvalues AS LONG) AS LONG

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
pvaluesOne or more values from the TEXTMODE enumeration type. The values specify the new settings for the control's text mode and undo level parameters.

Return value

If the message succeeds, the return value is zero.

If the message fails, the return value is a nonzero value.

Description

Sets the text mode or undo level of a rich edit control. The message fails if the control contains any text.

Specify one of the following values to set the text mode parameter. If you do not specify a text mode value, the text mode remains at its current setting.

Specify one of the following values to set the undo level parameter. If you do not specify an undo level value, the undo level remains at its current setting.

Specify one of the following values to set the code page parameter. If you do not specify an code page value, the code page remains at its current setting.

Remarks

In rich text mode, a rich edit control has standard rich edit functionality. However, in plain text mode, the control is similar to a standard edit control:

  • The text in a plain text control can have only one format (such as Bold, 10pt Arial).
  • The user cannot paste rich text formats, such as Rich Text Format (RTF) or embedded objects into a plain text control.
  • Rich text mode controls always have a default end-of-document marker or carriage return, to format paragraphs. Plain text controls, on the other hand, do not need the default, end-of-document marker, so it is omitted.

The control must contain no text when it receives the SetText message. To ensure there is no text, send a SetText message with an empty string ("").

Reference

  • Defined in AfxNova/CRichEdit.inc:1239
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class