How do you call a default view in MDI application?
-
I have created a simple MDI application with the MFC class wizard. At the moment I have only one view and one document. The view has CListView as a base class. I have disabled the new file option on startup by using cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; The user can either call a add menu option that displays a dialog box with which they can add data to the database, or they can pick a view menu option which will allow them to view all the data added on that particular day. My problem is calling the view from the mainframe menu option. I have read several articles but they all deal with adding documents and views and then swopping between them. I know I'm probably being very dense but have tried the whole of yesterday with no success.:-O . This is the code I'm using to initialize the List view in myView::OnInitialUpdate. DWORD dwExStyle; CRepPartDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); //CActionsApp *pApp = (CActionsApp*)AfxGetApp(); CListCtrl& m_List = GetListCtrl(); dwExStyle = m_List.GetExStyle(); dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES; m_List.SetExtendedStyle(dwExStyle); m_List.SetBkColor(RGB(255, 255, 255)); ASSERT(m_List.GetBkColor() == RGB(255, 255, 255)); m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160); m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90); m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90); m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90); m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160); Someone has suggested calling OnFileNew() from my menu handler but no success. Please help! Any suggestions will be more than I have already! Grasp it but you cannot get it! It's name is memory..