// RnameBlkDlg.cpp : implementation file // #include "stdafx.h" #include "RnameBlkDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRnameBlkDlg dialog CRnameBlkDlg::CRnameBlkDlg(CWnd* pParent /*=NULL*/) : CDialog(CRnameBlkDlg::IDD, pParent) { //{{AFX_DATA_INIT(CRnameBlkDlg) m_sNewBlockName = _T(""); m_sOldBlkName = _T(""); //}}AFX_DATA_INIT } void CRnameBlkDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRnameBlkDlg) DDX_Text(pDX, IDC_NEWBLOCKNAME, m_sNewBlockName); DDX_Text(pDX, IDC_OLDBLOCKNAME, m_sOldBlkName); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRnameBlkDlg, CDialog) //{{AFX_MSG_MAP(CRnameBlkDlg) ON_EN_CHANGE(IDC_NEWBLOCKNAME, OnChangeNewblockname) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRnameBlkDlg message handlers void CRnameBlkDlg::OnOK() { // TODO: Add extra validation here UpdateData(TRUE); m_sNewBlockName.TrimLeft(); m_sNewBlockName.TrimRight(); if(m_sNewBlockName.IsEmpty()) { AfxMessageBox(_T("不能为空")); return; } int nIndex; if(BaseFuncs::FindStringInArr(m_strRcdNames,m_sNewBlockName,nIndex)) { AfxMessageBox(_T("该名称已经存在")); return; } CDialog::OnOK(); } void CRnameBlkDlg::OnCancel() { // TODO: Add extra cleanup here CDialog::OnCancel(); } void CRnameBlkDlg::OnChangeNewblockname() { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here UpdateData(TRUE); }