home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch10 / mycombo / mycomvw.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-18  |  2.3 KB  |  107 lines

  1. // mycomvw.cpp : implementation of the CMycomboView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mycombo.h"
  6.  
  7. #include "mycomdoc.h"
  8. #include "mycomvw.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMycomboView
  17.  
  18. IMPLEMENT_DYNCREATE(CMycomboView, CView)
  19.  
  20. BEGIN_MESSAGE_MAP(CMycomboView, CView)
  21.     //{{AFX_MSG_MAP(CMycomboView)
  22.     ON_COMMAND(ID_FILE_TRYIT, OnFileTryit)
  23.     ON_COMMAND(ID_FILE_CURRENTITEM, OnFileCurrentitem)
  24.     //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMycomboView construction/destruction
  29.  
  30. CMycomboView::CMycomboView()
  31. {
  32.     // TODO: add construction code here
  33. }
  34.  
  35. CMycomboView::~CMycomboView()
  36. {
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CMycomboView drawing
  41.  
  42. void CMycomboView::OnDraw(CDC* pDC)
  43. {
  44.     CMycomboDoc* pDoc = GetDocument();
  45.     ASSERT_VALID(pDoc);
  46.  
  47.     // TODO: add draw code for native data here
  48. }
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CMycomboView diagnostics
  52.  
  53. #ifdef _DEBUG
  54. void CMycomboView::AssertValid() const
  55. {
  56.     CView::AssertValid();
  57. }
  58.  
  59. void CMycomboView::Dump(CDumpContext& dc) const
  60. {
  61.     CView::Dump(dc);
  62. }
  63.  
  64. CMycomboDoc* CMycomboView::GetDocument() // non-debug version is inline
  65. {
  66.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMycomboDoc)));
  67.     return (CMycomboDoc*)m_pDocument;
  68. }
  69. #endif //_DEBUG
  70.  
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CMycomboView message handlers
  73.  
  74. void CMycomboView::OnFileTryit()
  75. {
  76.     // TODO: Add your command handler code here
  77.     
  78.     //////////////////////
  79.     // MY CODE STARTS HERE
  80.     //////////////////////
  81.  
  82.     // Display the dialog box.
  83.     dlg.DoModal();
  84.  
  85.     ////////////////////
  86.     // MY CODE ENDS HERE
  87.     ////////////////////
  88.  
  89. }
  90.  
  91. void CMycomboView::OnFileCurrentitem()
  92. {
  93.     // TODO: Add your command handler code here
  94.  
  95.      //////////////////////
  96.      // MY CODE STARTS HERE
  97.      //////////////////////
  98.  
  99.      MessageBox ( "The current selection in the combo box is: "+
  100.                    dlg.m_SelectedItem);
  101.  
  102.      ////////////////////
  103.      // MY CODE ENDS HERE
  104.      ////////////////////
  105.  
  106. }
  107.