| 1 |
// GetInputDlg.cpp : implementation file |
|---|
| 2 |
// |
|---|
| 3 |
|
|---|
| 4 |
#include "stdafx.h" |
|---|
| 5 |
#include "Elephant.h" |
|---|
| 6 |
#include "GetInputDlg.h" |
|---|
| 7 |
|
|---|
| 8 |
#ifdef _DEBUG |
|---|
| 9 |
#define new DEBUG_NEW |
|---|
| 10 |
#undef THIS_FILE |
|---|
| 11 |
static char THIS_FILE[] = __FILE__; |
|---|
| 12 |
#endif |
|---|
| 13 |
|
|---|
| 14 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 15 |
// CGetInputDlg dialog |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
CGetInputDlg::CGetInputDlg(const string& text,const string& defaultEditText,CWnd* wnd ) |
|---|
| 19 |
: CDialog(CGetInputDlg::IDD, wnd) |
|---|
| 20 |
{ |
|---|
| 21 |
//{{AFX_DATA_INIT(CGetInputDlg) |
|---|
| 22 |
m_defaultText = defaultEditText; |
|---|
| 23 |
m_text = _T(text.c_str()); |
|---|
| 24 |
//}}AFX_DATA_INIT |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
void CGetInputDlg::DoDataExchange(CDataExchange* pDX) |
|---|
| 29 |
{ |
|---|
| 30 |
CDialog::DoDataExchange(pDX); |
|---|
| 31 |
//{{AFX_DATA_MAP(CGetInputDlg) |
|---|
| 32 |
DDX_Control(pDX, IDC_EDIT1, m_edit); |
|---|
| 33 |
DDX_Control(pDX, IDOK, m_ok); |
|---|
| 34 |
DDX_Control(pDX, IDCANCEL, m_cancel); |
|---|
| 35 |
DDX_Text(pDX, IDC_EDIT1, m_csValue); |
|---|
| 36 |
DDX_Text(pDX, IDC_STATIC1, m_text); |
|---|
| 37 |
//}}AFX_DATA_MAP |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
BEGIN_MESSAGE_MAP(CGetInputDlg, CDialog) |
|---|
| 42 |
//{{AFX_MSG_MAP(CGetInputDlg) |
|---|
| 43 |
//}}AFX_MSG_MAP |
|---|
| 44 |
END_MESSAGE_MAP() |
|---|
| 45 |
|
|---|
| 46 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 47 |
// CGetInputDlg message handlers |
|---|
| 48 |
|
|---|
| 49 |
BOOL CGetInputDlg::OnInitDialog() |
|---|
| 50 |
{ |
|---|
| 51 |
CDialog::OnInitDialog(); |
|---|
| 52 |
|
|---|
| 53 |
SetupButton(&m_ok); |
|---|
| 54 |
SetupButton(&m_cancel); |
|---|
| 55 |
|
|---|
| 56 |
m_cancel.SetFocus(); |
|---|
| 57 |
m_edit.SetText(m_defaultText); |
|---|
| 58 |
//m_edit.SetFocus(); |
|---|
| 59 |
|
|---|
| 60 |
SetIcon(AfxGetApp()->LoadIcon(IDR_ELEPHANT) ,true); |
|---|
| 61 |
|
|---|
| 62 |
return TRUE; // return TRUE unless you set the focus to a control |
|---|
| 63 |
// EXCEPTION: OCX Property Pages should return FALSE |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
void CGetInputDlg::OnOK() |
|---|
| 67 |
{ |
|---|
| 68 |
UpdateData(); |
|---|
| 69 |
|
|---|
| 70 |
EndDialog(1); |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
void CGetInputDlg::OnCancel() |
|---|
| 74 |
{ |
|---|
| 75 |
EndDialog(0) ; |
|---|
| 76 |
|
|---|
| 77 |
} |
|---|