This documentation is archived and is not being maintained.


Call GetEditCtrl to get a reference to the edit control used by the edit view.

CEdit& GetEditCtrl( ) const;

A reference to a CEdit object.

This control is of type CEdit, so you can manipulate the Windows edit control directly using the CEdit member functions.

Caution noteCaution

Using the CEdit object can change the state of the underlying Windows edit control. For example, you should not change the tab settings using the CEdit::SetTabStops function because CEditView caches these settings for use both in the edit control and in printing. Instead, use CEditView::SetTabStops.

   // get the edit control and set some initial properties for it
   CEdit& theEdit = GetEditCtrl();

   // adjust the left margin without changing the right margin
   DWORD dwMargins = theEdit.GetMargins();
   theEdit.SetMargins(20, HIWORD(dwMargins));

   // only accept 10k of text
   theEdit.SetLimitText(10 * 1024);