XCombo.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // XCombo.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "XCombo.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. UINT WM_XCOMBOLIST_COMPLETE = ::RegisterWindowMessage(_T("WM_XCOMBOLIST_COMPLETE"));
  11. //UINT WM_XCOMBOLIST_VK_ESCAPE = ::RegisterWindowMessage(_T("WM_XCOMBOLIST_VK_ESCAPE"));
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CXCombo
  14. BEGIN_MESSAGE_MAP(CXCombo, CAdvComboBox)
  15. //{{AFX_MSG_MAP(CXCombo)
  16. ON_WM_KILLFOCUS()
  17. //}}AFX_MSG_MAP
  18. END_MESSAGE_MAP()
  19. CXCombo::CXCombo(CWnd * pParent) :
  20. m_pParent(pParent),
  21. CAdvComboBox(FALSE, pParent)
  22. {
  23. XLISTCTRL_TRACE(_T("in CXCombo::CXCombo\n"));
  24. }
  25. CXCombo::~CXCombo()
  26. {
  27. XLISTCTRL_TRACE(_T("in CXCombo::~CXCombo\n"));
  28. }
  29. ///////////////////////////////////////////////////////////////////////////////
  30. // SendRegisteredMessage
  31. void CXCombo::SendRegisteredMessage(UINT nMsg, WPARAM wParam, LPARAM lParam)
  32. {
  33. CWnd *pWnd = m_pParent;
  34. if (pWnd)
  35. pWnd->SendMessage(nMsg, wParam, lParam);
  36. }
  37. ///////////////////////////////////////////////////////////////////////////////
  38. // CXCombo message handlers
  39. void CXCombo::OnKillFocus(CWnd* pNewWnd)
  40. {
  41. XLISTCTRL_TRACE(_T("in CXCombo::OnKillFocus\n"));
  42. CAdvComboBox::OnKillFocus(pNewWnd);
  43. if (pNewWnd != GetDropWnd())
  44. {
  45. SendRegisteredMessage(WM_XCOMBOLIST_COMPLETE, 0, 0);
  46. }
  47. }
  48. void CXCombo::OnEscapeKey()
  49. {
  50. XLISTCTRL_TRACE(_T("in CXCombo::OnEscapeKey\n"));
  51. SendRegisteredMessage(WM_XCOMBOLIST_VK_ESCAPE, 0, 0);
  52. }
  53. void CXCombo::OnComboComplete()
  54. {
  55. XLISTCTRL_TRACE(_T("in CXCombo::OnComboComplete\n"));
  56. SendRegisteredMessage(WM_XCOMBOLIST_COMPLETE, 0, 0);
  57. }