CEditView Class
A type of view class that provides the functionality of a Windows edit control and can be used to implement simple text-editor functionality.
class CEditView : public CCtrlView
Members
Public Constructors
Name |
Description |
---|---|
Constructs an object of type CEditView. |
Public Methods
Name |
Description |
---|---|
Searches for a string within the text. |
|
Obtains the length of the character buffer. |
|
Provides access to the CEdit portion of a CEditView object (the Windows edit control). |
|
Retrieves the current printer font. |
|
Retrieves the current text selection. |
|
Locks the buffer. |
|
Renders text inside a given rectangle. |
|
Serializes a CEditView object to disk as raw text. |
|
Sets a new printer font. |
|
Sets tab stops for both screen display and printing. |
|
Unlocks the buffer. |
Protected Methods
Name |
Description |
---|---|
Finds next occurrence of a text string. |
|
Replaces all occurrences of a given string with a new string. |
|
Replaces current selection. |
|
Called when a find operation fails to match any further text. |
Public Data Members
Name |
Description |
---|---|
Default style for objects of type CEditView. |
Remarks
The CEditView class provides the following additional functions:
Print.
Find and replace.
Because class CEditView is a derivative of class CView, objects of class CEditView can be used with documents and document templates.
Each CEditView control's text is kept in its own global memory object. Your application can have any number of CEditView objects.
Create objects of type CEditView if you want an edit window with the added functionality listed above, or if you want simple text-editor functionality. A CEditView object can occupy the entire client area of a window. Derive your own classes from CEditView to add or modify the basic functionality, or to declare classes that can be added to a document template.
The default implementation of class CEditView handles the following commands: ID_EDIT_SELECT_ALL, ID_EDIT_FIND, ID_EDIT_REPLACE, ID_EDIT_REPEAT, and ID_FILE_PRINT.
The default character limit for CEditView is (1024 * 1024 - 1 = 1048575). This can be changed by calling the EM_LIMITTEXT function of the underlying edit control. However, the limits are different depending on the operating system and the type of edit control (single or multiline). For more information on these limits, see EM_LIMITTEXT.
To change this limit in your control, override the OnCreate() function for your CEditView class and insert the following line of code:
GetEditCtrl().SetLimitText(nNewVal); //nNewVal, the new character limit
Objects of type CEditView (or of types derived from CEditView) have the following limitations:
CEditView does not implement true what you see is what you get (WYSIWYG) editing. Where there is a choice between readability on the screen and matching printed output, CEditView opts for screen readability.
CEditView can display text in only a single font. No special character formatting is supported. See class CRichEditView for greater capabilities.
The amount of text a CEditView can contain is limited. The limits are the same as for the CEdit control.
For more information on CEditView, see Derived View Classes Available in MFC.
Inheritance Hierarchy
CEditView
Requirements
Header: afxext.h