Export (0) Print
Expand All

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

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.

Header: afxext.h

In Windows CE-based projects, CEditView::LockBuffer and CEditView::UnlockBuffer do not lock and unlock the text contents of CEdit Class. LockBuffer only refreshes the m_pshadowbuffer buffer variable by checking for changes and then calling the inherited function CWnd::GetWindowText. Unlockbuffer does not do anything and is required for code compatibility.

Search over selected text does not work on Smartphone platforms because text cannot be selected on Smartphone devices.

The Smart Device version of CEditView Class does not support the following print methods:

Community Additions

ADD
Show:
© 2014 Microsoft