Repository navigation
Expand file tree
/
Copy pathsubtest.cpp
More file actions
83 lines (69 loc) · 1.96 KB
/
Copy pathsubtest.cpp
File metadata and controls
83 lines (69 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// subedit.cpp : SubClassed Edit control example
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "ctrltest.h"
#include "paredit.h"
/////////////////////////////////////////////////////////////////////////////
// Dialog class
class CSubEditDlg : public CDialog
{
protected:
CParsedEdit edit1, edit2, edit3, edit4;
public:
//{{AFX_DATA(CSubEditDlg)
enum { IDD = IDD_SUB_EDIT };
//}}AFX_DATA
CSubEditDlg()
: CDialog(CSubEditDlg::IDD)
{ }
BOOL OnInitDialog();
//{{AFX_MSG(CSubEditDlg)
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CSubEditDlg, CDialog)
//{{AFX_MSG_MAP(CSubEditDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CSubEditDlg::OnInitDialog()
{
edit1.SubclassEdit(IDC_EDIT1, this, PES_LETTERS);
edit2.SubclassEdit(IDC_EDIT2, this, PES_NUMBERS);
edit3.SubclassEdit(IDC_EDIT3, this, PES_NUMBERS | PES_LETTERS);
edit4.SubclassEdit(IDC_EDIT4, this, PES_ALL);
return TRUE;
}
void CSubEditDlg::OnOK()
{
#ifdef _DEBUG
// dump results, normally you would do something with these
CString s;
edit1.GetWindowText(s);
TRACE1("edit1 = '%s'\n", s);
edit2.GetWindowText(s);
TRACE1("edit2 = '%s'\n", s);
edit3.GetWindowText(s);
TRACE1("edit3 = '%s'\n", s);
edit4.GetWindowText(s);
TRACE1("edit4 = '%s'\n", s);
#endif
EndDialog(IDOK);
}
/////////////////////////////////////////////////////////////////////////////
// Run the test
void CTestWindow::OnTestSubclassedEdit()
{
TRACE0("running dialog containing edit items aliased to ParsedEdits\n");
CSubEditDlg dlg;
dlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////