Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Cant create view with RemoteData control on the CRecordView?

Hi,I'm doing project with several views.With the way i shift views from each
other,only one view got stuck on which there are DBGrid and RemoteData
controls(MyMonthlyReportView).The way i create new view is following:
Can anyone tell me what's the point?Thanx a lot in advance.If you dont
mind,please email straightly to wanglu@online.sh.cn

void MyMainView::OnView(UINT nCmdID)
{
/*nCmdID is assigned menu item ID specific to one view*/
/*then destroy old one,and create new one*/
CRuntimeClass* pNewViewClass;
swtich(nCmdID)
{
case ID_VIEW1:
.....
break;
case ID_MONTHLYVIEW:
pNewViewClass = RUNTIME_CLASS(MyMonthlyReportView);
break;
}
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = GetActiveDocument();
/*when to disp MyMonthlyReportView,CreateView() return NULL to me*/
CView* pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
if (pNewView != NULL)
{
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
SetActiveView(pNewView);
RecalcLayout();
m_nCurrentExample = nCmdID;

pOldActiveView->DestroyWindow();
}

}
[1235 byte] By [YOMI] at [2007-11-10 12:51:11]