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

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