OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

How to prevent Cut, Copy and Paste in TEdit control?

Date: 10 Jun 2000
Time: 06:43:49
Remote Name: 199.203.141.97

Comments

Q. How to prevent Cut, Copy and Paste in TEdit control?

A. 

Handle WM_CUT, WM_COPY and WM_PASTE messages in the edit control. 
Example:

class TMyEdit : public TEdit{
  public:
    TMyEdit(TWindow *parent, int id, int len) : TEdit(parent, id, len){}
 protected:
    LRESULT EvCut(WPARAM, LPARAM) { return 0; }
    LRESULT EvCopy(WPARAM, LPARAM) { return 0; }
    LRESULT EvPaste(WPARAM, LPARAM) { return 0; }
    DECLARE_RESPONSE_TABLE(TMyEdit);
};

DEFINE_RESPONSE_TABLE1(TMyEdit, TEdit)
  EV_MESSAGE(WM_CUT, EvCut),
  EV_MESSAGE(WM_COPY, EvCopy),
  EV_MESSAGE(WM_PASTE, EvPaste),
END_RESPONSE_TABLE;

Jogy

Last changed: July 14, 2001