www.pudn.com > 200518174534292.rar > InputBox.cpp


// InputBox.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "parksys.h" 
#include "InputBox.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CInputBox dialog 
 
 
CInputBox::CInputBox(CString strCaption 
		, CString strPrompt 
		, CString *pstrData 
		, CWnd* pParent /*=NULL*/) 
	: CDialog(CInputBox::IDD, pParent) 
	, m_strPrompt(strPrompt) 
	, m_pstrData(pstrData) 
	, m_strCaption(strCaption) 
{ 
	//{{AFX_DATA_INIT(CInputBox) 
	m_strData = _T(""); 
	//m_strPrompt = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CInputBox::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CInputBox) 
	DDX_Text(pDX, IDC_INPUT_DATA, m_strData); 
	DDX_Text(pDX, IDC_PROMPT, m_strPrompt); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CInputBox, CDialog) 
	//{{AFX_MSG_MAP(CInputBox) 
	ON_EN_CHANGE(IDC_INPUT_DATA, OnChangeInputData) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CInputBox message handlers 
 
void CInputBox::OnOK()  
{ 
	CDialog::OnOK(); 
	*m_pstrData = m_strData; 
 
} 
 
void CInputBox::OnCancel()  
{ 
	CDialog::OnCancel(); 
	*m_pstrData = ""; 
 
} 
 
BOOL CInputBox::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	SetWindowText(m_strCaption);	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CInputBox::OnChangeInputData()  
{ 
	// 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. 
	UpdateData(TRUE); 
 
	GetDlgItem(IDOK)->EnableWindow(m_strData != ""); 
	 
	// TODO: Add your control notification handler code here 
	 
}