CODEditComponent Class

class CODEditComponent: public CODControlComponent

This is a windowed component class that encapsulates an edit control. It overrides the  CODWndComponent::CreateWnd and creates an edit control.

This class contains a number of functions that are simple wrappers around Windows API functions that take a window handle. For complete documentation on the wrapper functions, consult the Windows API documentation.

Defined in: OdWndComp.h

Class Members

 CODEditComponent(const UINT nCtlID = 1)

Constructor.

 CODEditComponent(const CODEditComponent& src)

Copy constructor.

virtual  ~CODEditComponent()

Destructor.

virtual BOOL  CreateWnd(HWND hParent)

Creates and returns a window object to caller.

CODEditComponent&  operator=(const CODEditComponent& src)

Assignment operator.

virtual CODComponent*  Dup() const

Creates a copy of this component.

virtual void  Serialize(CArchive& ar)

Serializes the window component.

inline BOOL CanUndo() const

Call this function to determine if the last edit operation can be undone.

int GetLineCount() const

This method retrieves the number of lines in a multiple-line edit control.

inline BOOL GetModify() const

This method determines whether the contents of an edit control have been modified.

inline void SetModify(BOOL bModified = TRUE)

This method sets or clears the modified flag for an edit control.

inline void GetRect(LPRECT lpRect) const

Call this function to get the formatting rectangle of an edit control.

inline DWORD GetSel() const

Gets the starting and ending character positions of the current selection in an edit control.

inline void GetSel(int& nStartChar, int& nEndChar) const

Gets the starting and ending character positions of the current selection in an edit control.

inline HLOCAL GetHandle() const

Retrieves a handle to the memory currently allocated for a multiple-line edit control.

inline void SetHandle(HLOCAL hBuffer)

Sets the handle to the local memory that will be used by a multiple-line edit control.

inline void SetMargins(UINT nLeft, UINT nRight)

Sets the left and right margins of the edit control.

inline DWORD GetMargins() const

Gets the left and right margins of the edit control.

inline void SetLimitText(UINT nMax)

Sets the maximum amount of text this edit control can contain.

inline UINT GetLimitText() const

Gets the maximum amount of text this edit control can contain.

inline POINT PosFromChar(UINT nChar) const

Retrieves the coordinates of the upper-left corner of a specified character index.

inline int CharFromPos(POINT pt) const

Retrieves the line and character indices for the character closest to a specified position.

inline int GetLine(int nIndex, LPTSTR lpszBuffer) const

Retrieves a line of text from an edit control.

inline int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const

Retrieves a line of text from an edit control.

inline void EmptyUndoBuffer()

Clears the undo flag of an edit control.

inline BOOL FmtLines(BOOL bAddEOL)

Sets the formatting of an edit control.

inline void LimitText(int nChars = 0)

Limits the length of the text that the user may enter into an edit control.

inline int LineFromChar(int nIndex = -1) const

Retrieves the line number of the line that contains the specified character index.

inline int LineIndex(int nLine = -1) const

Retrieves the character index of a line within a multiple-line edit control.

inline int LineLength(int nLine = -1) const

Retrieves the length of a line in an edit control.

inline void LineScroll(int nLines, int nChars = 0)

Scrolls the text of a multiple-line edit control.

inline void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE)

Replaces the current selection in an edit control with the specified text.

inline void SetPasswordChar(TCHAR ch)

Sets or removes a password character displayed in an edit control when the user enters text.

inline void SetRect(LPCRECT lpRect)

Sets the formatting rectangle of a multiple-line edit control and updates the control.

inline void SetRectNP(LPCRECT lpRect)

Sets the formatting rectangle of a multiple-line edit control without redrawing the control window.

inline void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE)

Selects a range of characters in an edit control.

inline void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE)

Selects a range of characters in an edit control.

inline BOOL SetTabStops(int nTabStops, LPINT rgTabStops)

Sets the tab stops in a multiple-line edit control.

inline BOOL SetTabStops()

Sets the tab stops in a multiple-line edit control.

inline BOOL SetTabStops(const int& cxEachStop)

Sets the tab stops in a multiple-line edit control.

inline void ScrollCaret()

Scrolls the caret into view.

inline void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE)

Insert text at the given location in the edit control.

inline void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE)

Appends text to the current contents of the edit control.

inline BOOL Undo()

Undo the last operation in the edit control.

void Clear()

Deletes the current selection in the edit control.

inline void Copy()

Copies the current selection in the edit control to the Clipboard.

inline void Cut()

Deletes the current selection in the edit control and copies it to the Clipboard.

inline void Paste()

Inserts the data from the Clipboard into the edit control at the current cursor position.

inline BOOL SetReadOnly(BOOL bReadOnly = TRUE)

Sets a flag which determines if the edit control is read-only.

inline int GetFirstVisibleLine() const

Gets the index of the topmost visible line in the edit control.

inline TCHAR GetPasswordChar() const

Gets the current password character in the edit control.