Objective Grid : PART I User’s Guide : Chapter 8 DbQuery Tutorial : DbQuery - Step 3
DbQuery - Step 3
 
Add a New Frame Class
1. Select Class View from the View menu.
2. Right click on the root node (DbQuery) and select Add, then Class.
3. Select MFC in the left tree, and MFC Class from the right list box.
4. In the MFC Add Class Wizard, enter CRecordStatusMDIChildWnd for the Name.
5. In the MFC Add Class Wizard, specify CMDIChildWnd for the Base class.
6. Click Finish to generate the class files.
7. Right click CRecordStatusMDIChildWnd in Class view, and select Properties.
8. Click on overrides and select OnCreateClient in the list.
9. Pull down the combobox and select <Add> OnCreateClient in the Messages dropdown.
10. Change OnCreateClient() as follows:
 
BOOL CRecordStatusMDIChildWnd::OnCreateClient(
LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
return m_wndRecordInfo.Create(this, pContext);
}
11. Open RecordStatusMDIChildWnd.h and insert the following into the attributes section of the class:
 
CGXRecordInfoWnd m_wndRecordInfo;
12. Save and close RecordStatusMDIChildWnd.h and RecordStatusMDIChildWnd.cpp.
Change the DbQuery View to the New Frame Class
1. Open DbQuery.cpp.
2. Add
 
#include "RecordStatusMDIChildWnd.h"
after
 
#include "DbQueryView.h"
3. Search for:
 
pDocTemplate = new CMultiDocTemplate(
IDR_DBQUERTYPE,
RUNTIME_CLASS(CDbQueryDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDbQueryView));
AddDocTemplate(pDocTemplate);
and replace it with:
 
pDocTemplate = new CMultiDocTemplate(
IDR_DBQUERTYPE,
RUNTIME_CLASS(CDbQueryDoc),
RUNTIME_CLASS(CRecordStatusMDIChildWnd),
RUNTIME_CLASS(CDbQueryView));
AddDocTemplate(pDocTemplate);
Compile and Run DbQuery - Step 3
Now, you can compile the application and run it.
1. Compile the application and run it.
2. Note the record number at the bottom of the window.
Figure 107 – DbQuery-Step 3 in action
Congratulations on completing the DdQuery tutorial. For more information try these other tutorials:
Chapter 7, “1stGrid Tutorial.”
Chapter 8, “DbQuery Tutorial.”
Chapter 9, “DlgGrid Tutorial.”
Chapter 10, “VirtGrid Tutorial.”
Chapter 17, “CSliderCtrl Tutorial.”
Chapter 18, “BrwsGrid Tutorial.”