home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c08 / lab01 / ex01 / joinview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.9 KB  |  111 lines

  1. // JoinView.cpp : implementation of the CJoinView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Join.h"
  6.  
  7. #include "JoinSet.h"
  8. #include "JoinDoc.h"
  9. #include "JoinView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CJoinView
  19.  
  20. IMPLEMENT_DYNCREATE(CJoinView, CDaoRecordView)
  21.  
  22. BEGIN_MESSAGE_MAP(CJoinView, CDaoRecordView)
  23.     //{{AFX_MSG_MAP(CJoinView)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CJoinView construction/destruction
  31.  
  32. CJoinView::CJoinView()
  33.     : CDaoRecordView(CJoinView::IDD)
  34. {
  35.     //{{AFX_DATA_INIT(CJoinView)
  36.     m_pSet = NULL;
  37.     //}}AFX_DATA_INIT
  38.     // TODO: add construction code here
  39.  
  40. }
  41.  
  42. CJoinView::~CJoinView()
  43. {
  44. }
  45.  
  46. void CJoinView::DoDataExchange(CDataExchange* pDX)
  47. {
  48.     CDaoRecordView::DoDataExchange(pDX);
  49.     //{{AFX_DATA_MAP(CJoinView)
  50.     DDX_FieldText(pDX, IDC_FNAME, m_pSet->m_First_Name, m_pSet);
  51.     DDX_FieldText(pDX, IDC_LNAME, m_pSet->m_Last_Name, m_pSet);
  52.     DDX_FieldText(pDX, IDC_EMP_NO, m_pSet->m_Employee_Number, m_pSet);
  53.     DDX_FieldText(pDX, IDC_DEPT, m_pSet->m_Department__, m_pSet);
  54.     DDX_FieldText(pDX, IDC_PAY_TYPE, m_pSet->m_Employee_Pay_Type, m_pSet);
  55.     DDX_FieldText(pDX, IDC_HOUR_RATE, m_pSet->m_Hourly_Rate, m_pSet);
  56.     DDX_FieldText(pDX, IDC_BIRTH, m_pSet->m_Birthdate, m_pSet);
  57.     DDX_FieldText(pDX, IDC_MARITAL_STATUS, m_pSet->m_Sex___Marital_Status, m_pSet);
  58.     DDX_FieldText(pDX, IDC_HEIGHT, m_pSet->m_Height, m_pSet);
  59.     DDX_FieldText(pDX, IDC_WEIGHT, m_pSet->m_Weight, m_pSet);
  60.     //}}AFX_DATA_MAP
  61. }
  62.  
  63. BOOL CJoinView::PreCreateWindow(CREATESTRUCT& cs)
  64. {
  65.     // TODO: Modify the Window class or styles here by modifying
  66.     //  the CREATESTRUCT cs
  67.  
  68.     return CDaoRecordView::PreCreateWindow(cs);
  69. }
  70.  
  71. void CJoinView::OnInitialUpdate()
  72. {
  73.     m_pSet = &GetDocument()->m_joinSet;
  74.     CDaoRecordView::OnInitialUpdate();
  75.  
  76.     GetParentFrame()->RecalcLayout();
  77.     ResizeParentToFit(FALSE);
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CJoinView diagnostics
  82.  
  83. #ifdef _DEBUG
  84. void CJoinView::AssertValid() const
  85. {
  86.     CDaoRecordView::AssertValid();
  87. }
  88.  
  89. void CJoinView::Dump(CDumpContext& dc) const
  90. {
  91.     CDaoRecordView::Dump(dc);
  92. }
  93.  
  94. CJoinDoc* CJoinView::GetDocument() // non-debug version is inline
  95. {
  96.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CJoinDoc)));
  97.     return (CJoinDoc*)m_pDocument;
  98. }
  99. #endif //_DEBUG
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // CJoinView database support
  103. CDaoRecordset* CJoinView::OnGetRecordset()
  104. {
  105.     return m_pSet;
  106. }
  107.  
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CJoinView message handlers
  111.