www.pudn.com > 通讯录管理程序源代码(c).rar > NewEdit.cpp


// NewEdit.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "tbvc.h" 
#include "NewEdit.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CNewEdit 
 
CNewEdit::CNewEdit() 
{ 
	isReadOnly=FALSE; 
	 
} 
 
CNewEdit::~CNewEdit() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CNewEdit, CEdit) 
	//{{AFX_MSG_MAP(CNewEdit) 
	ON_WM_RBUTTONDOWN() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CNewEdit message handlers 
 
BOOL CNewEdit::PreTranslateMessage(MSG* pMsg)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
 
	if(isReadOnly && (pMsg->message==WM_KEYDOWN)) 
	{ 
		if(!(pMsg->wParam==13||pMsg->wParam==9)) 
			return TRUE; 
	} 
 
    if(pMsg->wParam==13) pMsg->wParam=9; 
	return CEdit::PreTranslateMessage(pMsg); 
} 
 
 
void CNewEdit::SetReadOnlyState(BOOL isro) 
{ 
	isReadOnly=isro; 
} 
 
void CNewEdit::OnRButtonDown(UINT nFlags, CPoint point)  
{ 
	// TODO: Add your message handler code here and/or call default 
	if(!isReadOnly) 
		CEdit::OnRButtonDown(nFlags, point); 
}