【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了CellEdit.cpp相关资料,希望对各位网友有所帮助!
// CellEdit.cpp : implementation file
//
#include "stdafx.h"
#include "EditGridDemo.h"
#include "CellEdit.h"
#include "EditGrid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCellEdit
CCellEdit::CCellEdit()
{
}
CCellEdit::~CCellEdit()
{
}
BEGIN_MESSAGE_MAP(CCellEdit, CEdit)
//{{AFX_MSG_MAP(CCellEdit)
ON_WM_CHAR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCellEdit message handlers
void CCellEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
//如果按下的是回车键
if (nChar == 13)
{
//得到其从属的Grid
CEditGrid * pGrid = (CEditGrid * )(GetParent());
//将用户输入的内容写入格子
CString str;
GetWindowText(str);
pGrid->SetText(str);
//清空文本框
SetWindowText("");
//隐藏
ShowWindow(SW_HIDE);
//格子设置焦点
pGrid->SetFocus();
}
//如果按下的是取消键
else if (nChar == 27)
{
//得到其从属的Grid
CEditGrid * pGrid = (CEditGrid * )(GetParent());
//清空文本框
SetWindowText("");
//隐藏
ShowWindow(SW_HIDE);
//格子设置焦点
pGrid->SetFocus();
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
void CCellEdit::OnEnterKey()
{
OnChar(13, 0, 0);
}
void CCellEdit::OnEscKey()
{
OnChar(27, 0, 0);
}
上一篇:
CellDoc.cpp
下一篇:
梅奥的人际关系学说与我国的人本管理