Share via


CRichEditCtrl Class

Provides the functionality of the rich edit control.

class CRichEditCtrl : public CWnd

Members

Public Constructors

Name

Description

CRichEditCtrl::CRichEditCtrl

Constructs a CRichEditCtrl object.

Public Methods

Name

Description

CRichEditCtrl::CanPaste

Determines if the contents of the Clipboard can be pasted into this rich edit control.

CRichEditCtrl::CanRedo

Determines whether there are any actions in the control's redo queue.

CRichEditCtrl::CanUndo

Determines if an editing operation can be undone.

CRichEditCtrl::CharFromPos

Retrieves information about the character closest to a specified point in the client area of an edit control.

CRichEditCtrl::Clear

Clears the current selection.

CRichEditCtrl::Copy

Copies the current selection to the Clipboard.

CRichEditCtrl::Create

Creates the Windows rich edit control and associates it with this CRichEditCtrl object.

CRichEditCtrl::CreateEx

Creates the Windows rich edit control with the specified extended Windows styles and associates it with this CRichEditCtrl object.

CRichEditCtrl::Cut

Cuts the current selection to the Clipboard.

CRichEditCtrl::DisplayBand

Displays a portion of the contents of this CRichEditCtrl object.

CRichEditCtrl::EmptyUndoBuffer

Resets (clears) the undo flag of this CRichEditCtrl object.

CRichEditCtrl::FindText

Locates text within this CRichEditCtrl object.

CRichEditCtrl::FindWordBreak

Finds the next word break before or after the specified character position, or retrieves information about the character at that position.

CRichEditCtrl::FormatRange

Formats a range of text for the target output device.

CRichEditCtrl::GetCharPos

Determines the location of a given character within this CRichEditCtrl object.

CRichEditCtrl::GetDefaultCharFormat

Retrieves the current default character formatting attributes in this CRichEditCtrl object.

CRichEditCtrl::GetEventMask

Retrieves the event mask for this CRichEditCtrl object.

CRichEditCtrl::GetFirstVisibleLine

Determines the topmost visible line in this CRichEditCtrl object.

CRichEditCtrl::GetIRichEditOle

Retrieves a pointer to the IRichEditOle interface for this rich edit control.

CRichEditCtrl::GetLimitText

Gets the limit on the amount of text a user can enter into this CRichEditCtrl object.

CRichEditCtrl::GetLine

Retrieves a line of text from this CRichEditCtrl object.

CRichEditCtrl::GetLineCount

Retrieves the number of lines in this CRichEditCtrl object.

CRichEditCtrl::GetModify

Determines if the contents of this CRichEditCtrl object have changed since the last save.

CRichEditCtrl::GetOptions

Retrieves the rich edit control options.

CRichEditCtrl::GetParaFormat

Retrieves the paragraph formatting attributes in the current selection in this CRichEditCtrl object.

CRichEditCtrl::GetPunctuation

Retrieves the current punctuation characters for the rich edit control. This message is available only in Asian-language versions of the operating system.

CRichEditCtrl::GetRect

Retrieves the formatting rectangle for this CRichEditCtrl object.

CRichEditCtrl::GetRedoName

Retrieves the type of the next action, if any, in the control's redo queue.

CRichEditCtrl::GetSel

Gets the starting and ending positions of the current selection in this CRichEditCtrl object.

CRichEditCtrl::GetSelectionCharFormat

Retrieves the character formatting attributes in the current selection in this CRichEditCtrl object.

CRichEditCtrl::GetSelectionType

Retrieves the type of contents in the current selection in this CRichEditCtrl object.

CRichEditCtrl::GetSelText

Gets the text of the current selection in this CRichEditCtrl object

CRichEditCtrl::GetTextLength

Retrieves the length of the text, in characters, in this CRichEditCtrl object. Does not include the terminating null character.

CRichEditCtrl::GetTextLengthEx

Retrieves the number of characters or bytes in the rich edit view. Accepts a list of flags to indicate the method of determining length of the text in a rich edit control

CRichEditCtrl::GetTextMode

Retrieves the current text mode and undo level of a rich edit control.

CRichEditCtrl::GetTextRange

Retrieves the specified range of text.

CRichEditCtrl::GetUndoName

Retrieves the type of the next undo action, if any.

CRichEditCtrl::GetWordWrapMode

Retrieves the current word wrapping and word breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system.

CRichEditCtrl::HideSelection

Shows or hides the current selection.

CRichEditCtrl::LimitText

Limits the amount of text a user can enter into the CRichEditCtrl object.

CRichEditCtrl::LineFromChar

Determines which line contains the given character.

CRichEditCtrl::LineIndex

Retrieves the character index of a given line in this CRichEditCtrl object.

CRichEditCtrl::LineLength

Retrieves the length of a given line in this CRichEditCtrl object.

CRichEditCtrl::LineScroll

Scrolls the text in this CRichEditCtrl object.

CRichEditCtrl::Paste

Inserts the contents of the Clipboard into this rich edit control.

CRichEditCtrl::PasteSpecial

Inserts the contents of the Clipboard into this rich edit control in the specified data format.

CRichEditCtrl::PosFromChar

Retrieves the client area coordinates of a specified character in an edit control.

CRichEditCtrl::Redo

Redoes the next action in the control's redo queue.

CRichEditCtrl::ReplaceSel

Replaces the current selection in this CRichEditCtrl object with specified text.

CRichEditCtrl::RequestResize

Forces this CRichEditCtrl object to send request resize notifications.

CRichEditCtrl::SetAutoURLDetect

Indicates if the auto URL detection is active in a rich edit control.

CRichEditCtrl::SetBackgroundColor

Sets the background color in this CRichEditCtrl object.

CRichEditCtrl::SetDefaultCharFormat

Sets the current default character formatting attributes in this CRichEditCtrl object.

CRichEditCtrl::SetEventMask

Sets the event mask for this CRichEditCtrl object.

CRichEditCtrl::SetModify

Sets or clears the modification flag for this CRichEditCtrl object.

CRichEditCtrl::SetOLECallback

Sets the IRichEditOleCallback COM object for this rich edit control.

CRichEditCtrl::SetOptions

Sets the options for this CRichEditCtrl object.

CRichEditCtrl::SetParaFormat

Sets the paragraph formatting attributes in the current selection in this CRichEditCtrl object.

CRichEditCtrl::SetPunctuation

Sets the punctuation characters for a rich edit control. This message is available only in Asian-language versions of the operating system.

CRichEditCtrl::SetReadOnly

Sets the read-only option for this CRichEditCtrl object.

CRichEditCtrl::SetRect

Sets the formatting rectangle for this CRichEditCtrl object.

CRichEditCtrl::SetSel

Sets the selection in this CRichEditCtrl object.

CRichEditCtrl::SetSelectionCharFormat

Sets the character formatting attributes in the current selection in this CRichEditCtrl object.

CRichEditCtrl::SetTargetDevice

Sets the target output device for this CRichEditCtrl object.

CRichEditCtrl::SetTextMode

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

CRichEditCtrl::SetUndoLimit

Sets the maximum number of actions that can stored in the undo queue.

CRichEditCtrl::SetWordCharFormat

Sets the character formatting attributes in the current word in this CRichEditCtrl object.

CRichEditCtrl::SetWordWrapMode

Sets the word-wrapping and word-breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system.

CRichEditCtrl::StopGroupTyping

Stops the control from collecting additional typing actions into the current undo action. The control stores the next typing action, if any, into a new action in the undo queue.

CRichEditCtrl::StreamIn

Inserts text from an input stream into this CRichEditCtrl object.

CRichEditCtrl::StreamOut

Stores text from this CRichEditCtrl object into an output stream.

CRichEditCtrl::Undo

Reverses the last editing operation.

Remarks

A "rich edit control" is a window in which the user can enter and edit text. The text can be assigned character and paragraph formatting, and can include embedded OLE objects. Rich edit controls provide a programming interface for formatting text. However, an application must implement any user interface components necessary to make formatting operations available to the user.

This Windows Common control (and therefore the CRichEditCtrl class) is available only to programs running under Windows 95/98 and Windows NT versions 3.51 and later. The CRichEditCtrl class supports versions 2.0 and 3.0 of the Windows SDK rich edit control.

Warning

If you are using a rich edit control in a dialog box (regardless whether your application is SDI, MDI, or dialog-based), you must call AfxInitRichEdit once before the dialog box is displayed. A typical place to call this function is in your program's InitInstance member function. You do not need to call it for each time you display the dialog box, only the first time. You do not have to call AfxInitRichEdit if you are working with CRichEditView.

For more information on using CRichEditCtrl, see:

  • Controls

  • Using CRichEditCtrl

  • Knowledge Base article Q259949 : INFO: SetCaretPos() Is Not Appropriate with CEdit or CRichEditCtrl Controls

For an example of using a rich edit control in an MFC application, see the WORDPAD sample application.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CRichEditCtrl

Requirements

Header: afxcmn.h

See Also

Reference

CWnd Class

Hierarchy Chart

CEdit Class

CRichEditView Class

Concepts

MFC Sample WORDPAD