home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Java++ / SHAREDIDE / BIN / MFCCLWZ.DLL / SRCDATA / RECVIEW.CPP < prev    next >
Encoding:
Text File  |  1997-01-27  |  2.8 KB  |  141 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // %1
  3.  
  4. IMPLEMENT_DYNCREATE(%1, CRecordView)
  5.  
  6. %1::%1()
  7.     : CRecordView(%1::IDD)
  8. {
  9. $$IF(OLEAUTO)
  10.     EnableAutomation();
  11. $$ENDIF
  12. $$IF(OLECREATE)
  13.     
  14.     // To keep the application running as long as an OLE automation 
  15.     //    object is active, the constructor calls AfxOleLockApp.
  16.     
  17.     AfxOleLockApp();
  18.  
  19. $$ENDIF
  20.     //{{AFX_DATA_INIT(%1)
  21.     m_pSet = NULL;
  22.     //}}AFX_DATA_INIT
  23. }
  24.  
  25. %1::~%1()
  26. {
  27.     if (m_pSet)
  28.         delete m_pSet;
  29. $$IF(OLECREATE)
  30.  
  31.     // To terminate the application when all objects created with
  32.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  33.     
  34.     AfxOleUnlockApp();
  35. $$ENDIF
  36. }
  37. $$IF(OLEAUTO)
  38.  
  39. void %1::OnFinalRelease()
  40. {
  41.     // When the last reference for an automation object is released
  42.     // OnFinalRelease is called.  The base class will automatically
  43.     // deletes the object.  Add additional cleanup required for your
  44.     // object before calling the base class.
  45.  
  46.     CRecordView::OnFinalRelease();
  47. }
  48. $$ENDIF
  49.  
  50. void %1::DoDataExchange(CDataExchange* pDX)
  51. {
  52.     CRecordView::DoDataExchange(pDX);
  53.     //{{AFX_DATA_MAP(%1)
  54.         // NOTE: the ClassWizard will add DDX and DDV calls here
  55.     //}}AFX_DATA_MAP
  56. }
  57.  
  58.  
  59. BEGIN_MESSAGE_MAP(%1, CRecordView)
  60.     //{{AFX_MSG_MAP(%1)
  61.         // NOTE - the ClassWizard will add and remove mapping macros here.
  62.     //}}AFX_MSG_MAP
  63. END_MESSAGE_MAP()
  64. $$IF(OLEAUTO)
  65.  
  66. BEGIN_DISPATCH_MAP(%1, CRecordView)
  67.     //{{AFX_DISPATCH_MAP(%1)
  68.         // NOTE - the ClassWizard will add and remove mapping macros here.
  69.     //}}AFX_DISPATCH_MAP
  70. END_DISPATCH_MAP()
  71.  
  72. // Note: we add support for IID_I%c to support typesafe binding
  73. //  from VBA.  This IID must match the GUID that is attached to the 
  74. //  dispinterface in the .ODL file.
  75.  
  76. // {%b}
  77. static const IID IID_I%c =
  78. %d;
  79.  
  80. BEGIN_INTERFACE_MAP(%1, CRecordView)
  81.     INTERFACE_PART(%1, IID_I%c, Dispatch)
  82. END_INTERFACE_MAP()
  83. $$ENDIF //OLEAUTO
  84. $$IF(OLECREATE)
  85.  
  86. // {%e}
  87. IMPLEMENT_OLECREATE(%1, "%6", %7)
  88. $$ENDIF //OLECREATE
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // %1 diagnostics
  92.  
  93. #ifdef _DEBUG
  94. void %1::AssertValid() const
  95. {
  96.     CRecordView::AssertValid();
  97. }
  98.  
  99. void %1::Dump(CDumpContext& dc) const
  100. {
  101.     CRecordView::Dump(dc);
  102. }
  103. #endif //_DEBUG
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // %1 message handlers
  107.  
  108. CRecordset* %1::OnGetRecordset()
  109. {
  110.     if (m_pSet != NULL)
  111.         return m_pSet;
  112.  
  113.     m_pSet = new %8(NULL);
  114.     m_pSet->Open();
  115.  
  116.     return m_pSet;
  117. }
  118.  
  119. %8* %1::GetRecordset()
  120. {
  121.     %8* pData = (%8*) OnGetRecordset();
  122.     ASSERT(pData == NULL || pData->IsKindOf(RUNTIME_CLASS(%8)));
  123.     return pData;
  124. }
  125.  
  126. void %1::OnInitialUpdate()
  127. {
  128.     BeginWaitCursor();
  129.     GetRecordset();
  130.     CRecordView::OnInitialUpdate();
  131.     if (m_pSet->IsOpen())
  132.     {
  133.         CString strTitle = m_pSet->m_pDatabase->GetDatabaseName();
  134.         CString strTable = m_pSet->GetTableName();
  135.         if (!strTable.IsEmpty())
  136.             strTitle += _T(":") + strTable;
  137.         GetDocument()->SetTitle(strTitle);
  138.     }
  139.     EndWaitCursor();
  140. }