home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch12 / test / testview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-20  |  2.8 KB  |  143 lines

  1. // testview.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "test.h"
  6. #include "testview.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CTestView
  15.  
  16. IMPLEMENT_DYNCREATE(CTestView, CFormView)
  17.  
  18. CTestView::CTestView()
  19.     : CFormView(CTestView::IDD)
  20. {
  21.     //{{AFX_DATA_INIT(CTestView)
  22.     m_MyEditBox = "";
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26. CTestView::~CTestView()
  27. {
  28. }
  29.  
  30. void CTestView::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CFormView::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CTestView)
  34.     DDX_Text(pDX, IDC_EDIT1, m_MyEditBox);
  35.     //}}AFX_DATA_MAP
  36. }
  37.  
  38.  
  39. BEGIN_MESSAGE_MAP(CTestView, CFormView)
  40.     //{{AFX_MSG_MAP(CTestView)
  41.     ON_BN_CLICKED(IDC_TEST_BUTTON, OnTestButton)
  42.     ON_BN_CLICKED(IDC_CLEAR_BUTTON, OnClearButton)
  43.     ON_COMMAND(ID_FILE_TEST, OnFileTest)
  44.     ON_COMMAND(ID_FILE_CLEAR, OnFileClear)
  45.     ON_COMMAND(ID_FILE_CURRENTVALUE, OnFileCurrentvalue)
  46.     //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48.  
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CTestView message handlers
  52.  
  53.  
  54. void CTestView::OnTestButton()
  55. {
  56.     // TODO: Add your control notification handler code here
  57.  
  58.      //////////////////////
  59.      // MY CODE STARTS HERE
  60.      //////////////////////
  61.  
  62.      // Fill the edit box with text.
  63.      m_MyEditBox = "THIS IS A TEST";
  64.      UpdateData(FALSE);
  65.  
  66.      ////////////////////
  67.      // MY CODE ENDS HERE
  68.      ////////////////////
  69.  
  70.     
  71. }
  72.  
  73. void CTestView::OnClearButton()
  74. {
  75.     // TODO: Add your control notification handler code here
  76.  
  77.      //////////////////////
  78.      // MY CODE STARTS HERE
  79.      //////////////////////
  80.  
  81.      // Fill the edit box with null.
  82.      m_MyEditBox = "";
  83.      UpdateData(FALSE);
  84.  
  85.      ////////////////////
  86.      // MY CODE ENDS HERE
  87.      ////////////////////
  88. }
  89.  
  90. void CTestView::OnFileTest()
  91. {
  92.     // TODO: Add your command handler code here
  93.     
  94.      //////////////////////
  95.      // MY CODE STARTS HERE
  96.      //////////////////////
  97.  
  98.      OnTestButton();
  99.  
  100.      ////////////////////
  101.      // MY CODE ENDS HERE
  102.      ////////////////////
  103.  
  104.  
  105. }
  106.  
  107. void CTestView::OnFileClear()
  108. {
  109.     // TODO: Add your command handler code here
  110.  
  111.  
  112.      //////////////////////
  113.      // MY CODE STARTS HERE
  114.      //////////////////////
  115.  
  116.      OnClearButton();
  117.  
  118.      ////////////////////
  119.      // MY CODE ENDS HERE
  120.      ////////////////////
  121.     
  122. }
  123.  
  124. void CTestView::OnFileCurrentvalue()
  125. {
  126.     // TODO: Add your command handler code here
  127.  
  128.     //////////////////////
  129.      // MY CODE STARTS HERE
  130.      //////////////////////
  131.  
  132.      // Display the current contents of the edit box.
  133.      UpdateData(TRUE);
  134.      MessageBox("Current value of m_MyEditBox = "
  135.                         + m_MyEditBox);
  136.  
  137.      ////////////////////
  138.      // MY CODE ENDS HERE
  139.      ////////////////////
  140.  
  141.     
  142. }
  143.