home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch13 / memo / memoview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-20  |  5.2 KB  |  237 lines

  1. // memoview.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "memo.h"
  6.  
  7. //////////////////////
  8. // MY CODE STARTS HERE
  9. //////////////////////
  10.  
  11. #include "memodoc.h"
  12.  
  13. ////////////////////
  14. // MY CODE ENDS HERE
  15. ////////////////////
  16.  
  17.  
  18. #include "memoview.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMemoView
  27.  
  28. IMPLEMENT_DYNCREATE(CMemoView, CFormView)
  29.  
  30. CMemoView::CMemoView()
  31.     : CFormView(CMemoView::IDD)
  32. {
  33.     //{{AFX_DATA_INIT(CMemoView)
  34.     m_Date = "";
  35.     m_Ref = "";
  36.     m_From = "";
  37.     m_To = "";
  38.     m_Memo = "";
  39.     //}}AFX_DATA_INIT
  40. }
  41.  
  42. CMemoView::~CMemoView()
  43. {
  44. }
  45.  
  46. void CMemoView::DoDataExchange(CDataExchange* pDX)
  47. {
  48.     CFormView::DoDataExchange(pDX);
  49.     //{{AFX_DATA_MAP(CMemoView)
  50.     DDX_Text(pDX, IDC_DATE, m_Date);
  51.     DDX_Text(pDX, IDC_REF, m_Ref);
  52.     DDX_Text(pDX, IDC_FROM, m_From);
  53.     DDX_Text(pDX, IDC_TO, m_To);
  54.     DDX_Text(pDX, IDC_MEMO, m_Memo);
  55.     //}}AFX_DATA_MAP
  56. }
  57.  
  58.  
  59. BEGIN_MESSAGE_MAP(CMemoView, CFormView)
  60.     //{{AFX_MSG_MAP(CMemoView)
  61.     ON_EN_CHANGE(IDC_DATE, OnChangeDate)
  62.     ON_EN_CHANGE(IDC_REF, OnChangeRef)
  63.     ON_EN_CHANGE(IDC_FROM, OnChangeFrom)
  64.     ON_EN_CHANGE(IDC_TO, OnChangeTo)
  65.     ON_EN_CHANGE(IDC_MEMO, OnChangeMemo)
  66.     //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68.  
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMemoView message handlers
  72.  
  73.  
  74. ///////////////////////
  75. // MY CODE STARTS HERE
  76. //////////////////////
  77.  
  78. void CMemoView::OnInitialUpdate()
  79. {
  80.  
  81.   // Get a pointer to the document.
  82.   CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  83.  
  84.   // Update the data members of the view class with the
  85.   // current values of the data members of document class.
  86.   m_Date = pDoc->m_Date;
  87.   m_Ref  = pDoc->m_Ref;
  88.   m_From = pDoc->m_From;
  89.   m_To   = pDoc->m_To;
  90.   m_Memo = pDoc->m_Memo;
  91.  
  92.   // Update the screen with the new values of the variables.
  93.   UpdateData(FALSE);
  94.  
  95. }
  96.  
  97. ////////////////////
  98. // MY CODE ENDS HERE
  99. ////////////////////  
  100.  
  101. void CMemoView::OnChangeDate()
  102. {
  103.     // TODO: Add your control notification handler code here
  104.     
  105.    //////////////////////
  106.    // MY CODE STARTS HERE
  107.    //////////////////////
  108.  
  109.    // Update the variables of the controls with the current
  110.    // values inside the controls.
  111.    UpdateData(TRUE);
  112.  
  113.    // Get a pointer to the document.
  114.    CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  115.  
  116.    // Update the m_Date data member of the document class.
  117.    pDoc->m_Date = m_Date;
  118.  
  119.    // Set the Modified flag of the document class to TRUE.
  120.    pDoc->SetModifiedFlag();
  121.  
  122.    ////////////////////
  123.    // MY CODE ENDS HERE
  124.    ////////////////////
  125.  
  126. }
  127.  
  128. void CMemoView::OnChangeRef()
  129. {
  130.     // TODO: Add your control notification handler code here
  131.     
  132.    //////////////////////
  133.    // MY CODE STARTS HERE
  134.    //////////////////////
  135.  
  136.    // Update the variables of the controls with the current
  137.    // values inside the controls.
  138.    UpdateData(TRUE);
  139.  
  140.    // Get a pointer to the document.
  141.    CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  142.  
  143.    // Update the m_Ref data member of the document class.
  144.    pDoc->m_Ref = m_Ref;
  145.  
  146.    // Set the Modified flag of the document class to TRUE.
  147.    pDoc->SetModifiedFlag();
  148.  
  149.    ////////////////////
  150.    // MY CODE ENDS HERE
  151.    ////////////////////
  152.  
  153.  
  154. }
  155.  
  156. void CMemoView::OnChangeFrom()
  157. {
  158.     // TODO: Add your control notification handler code here
  159.  
  160.    //////////////////////
  161.    // MY CODE STARTS HERE
  162.    //////////////////////
  163.  
  164.    // Update the variables of the controls with the current
  165.    // values inside the controls.
  166.    UpdateData(TRUE);
  167.  
  168.    // Get a pointer to the document.
  169.    CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  170.  
  171.    // Update the m_From data member of the document class.
  172.    pDoc->m_From = m_From;
  173.  
  174.    // Set the Modified flag of the document class to TRUE.
  175.    pDoc->SetModifiedFlag();
  176.  
  177.    ////////////////////
  178.    // MY CODE ENDS HERE
  179.    ////////////////////
  180.     
  181. }
  182.  
  183. void CMemoView::OnChangeTo()
  184. {
  185.     // TODO: Add your control notification handler code here
  186.  
  187.    //////////////////////
  188.    // MY CODE STARTS HERE
  189.    //////////////////////
  190.  
  191.    // Update the variables of the controls with the current
  192.    // values inside the controls.
  193.    UpdateData(TRUE);
  194.  
  195.    // Get a pointer to the document.
  196.    CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  197.  
  198.    // Update the m_To data member of the document class.
  199.    pDoc->m_To = m_To;
  200.  
  201.    // Set the Modified flag of the document class to TRUE.
  202.    pDoc->SetModifiedFlag();
  203.  
  204.    ////////////////////
  205.    // MY CODE ENDS HERE
  206.    ////////////////////
  207. }
  208.  
  209. void CMemoView::OnChangeMemo()
  210. {
  211.     // TODO: Add your control notification handler code here
  212.     
  213.  
  214.    //////////////////////
  215.    // MY CODE STARTS HERE
  216.    //////////////////////
  217.  
  218.    // Update the variables of the controls with the current
  219.    // values inside the controls.
  220.    UpdateData(TRUE);
  221.  
  222.    // Get a pointer to the document.
  223.    CMemoDoc* pDoc = (CMemoDoc*) GetDocument();
  224.  
  225.    // Update the m_Memo data member of the document class.
  226.    pDoc->m_Memo = m_Memo;
  227.  
  228.    // Set the Modified flag of the document class to TRUE.
  229.    pDoc->SetModifiedFlag();
  230.  
  231.    ////////////////////
  232.    // MY CODE ENDS HERE
  233.    ////////////////////
  234.  
  235.  
  236. }
  237.