-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditCR.cpp
92 lines (76 loc) · 2.01 KB
/
EditCR.cpp
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
84
85
86
87
88
89
90
91
92
/*******************************************************************************
Copyright (c) 1999-2010 by Text Analysis International, Inc.
All rights reserved.
*******************************************************************************/
// EditCR.cpp : implementation file
//
#include "stdafx.h"
#include "kb.h"
#include "Utils.h"
#include "VisualText.h"
#include "EditCR.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEditCR
CEditCR::CEditCR()
{
}
CEditCR::~CEditCR()
{
}
BEGIN_MESSAGE_MAP(CEditCR, CEdit)
//{{AFX_MSG_MAP(CEditCR)
ON_WM_GETDLGCODE()
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditCR message handlers
BOOL CEditCR::AutoLoad(UINT nID, CWnd* pParent, UINT nIDCR)
{
if (!SubclassDlgItem(nID, pParent))
return FALSE;
m_nIDCR = nIDCR;
return true;
}
UINT CEditCR::OnGetDlgCode()
{
// TODO: Add your message handler code here and/or call default
return (DLGC_WANTALLKEYS);
// return CEdit::OnGetDlgCode();
}
#define ID_EDITCTRL_IN_COMBOBOX 1001
void CEditCR::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CWnd *pParent = GetParent();
CWnd *pBtn;
if (pParent && ::GetWindowLong(m_hWnd, GWL_ID) == ID_EDITCTRL_IN_COMBOBOX)
pParent = pParent->GetParent();
if (pParent) {
BOOL bShift;
switch (nChar) {
case VK_ESCAPE:
pParent->SendMessage(WM_COMMAND, IDCANCEL, 0L);
return;
case VK_RETURN:
pBtn = pParent->GetDlgItem(m_nIDCR);
if (pBtn) {
pParent->SendMessage(WM_COMMAND,
(WPARAM)MAKELONG(m_nIDCR, BN_CLICKED),
(LPARAM)pBtn->m_hWnd);
}
return;
case VK_TAB:
bShift = ISKEYPRESSED(VK_SHIFT);
pParent->SendMessage(WM_NEXTDLGCTL, bShift, 0);
return;
default:
break;
}
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}