Calling CListview in MDI application
-
I have created an MDI application whose view is derived from CList. I only have one view and one document. I have used the cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; option to disable the default OnFileNew(). Now I have a application that opens with only a menu. How do I now call my List view(default view) from the mainframe menu? I have added a menu Item, attached a handler to it and tried calling OnFileNew from there. But no List view. Sob.:(( I have read a million msdn files, 2 chapters on MDI applications but still no flashes of intelligence. I'm trying to populate my ListView9defaultview) with items by directly accessing its list control through a call to GetListCtrl() in the OnInitialUpdate() function in my view class. If I take the code populating the control out from OnInitial update, I get a white empty file opening, if I leave it in I get a file with exactly the same grey background as my main window. Am I maybe missing the plot completely? I hope I'm making sense, my brain is so fried it took me 20 minutes to find my office key and leave the building. Please help!:eek: Grasp it but you cannot get it! It's name is memory..
-
I have created an MDI application whose view is derived from CList. I only have one view and one document. I have used the cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; option to disable the default OnFileNew(). Now I have a application that opens with only a menu. How do I now call my List view(default view) from the mainframe menu? I have added a menu Item, attached a handler to it and tried calling OnFileNew from there. But no List view. Sob.:(( I have read a million msdn files, 2 chapters on MDI applications but still no flashes of intelligence. I'm trying to populate my ListView9defaultview) with items by directly accessing its list control through a call to GetListCtrl() in the OnInitialUpdate() function in my view class. If I take the code populating the control out from OnInitial update, I get a white empty file opening, if I leave it in I get a file with exactly the same grey background as my main window. Am I maybe missing the plot completely? I hope I'm making sense, my brain is so fried it took me 20 minutes to find my office key and leave the building. Please help!:eek: Grasp it but you cannot get it! It's name is memory..
Had a cup of tea, am felling calmer so here are more details. The view that I'm trying to call is derived from CListview and is a report style List view showing database information in an Access like gridview. This is the code I'm using to initialise it 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); I have used it before in a SDI application that opened on this view with no problems whatsoever, which leads me to believe there must be a special way of calling the same view from a menu within a MDI application that I'm missing. This is the only code I have in the menu handler function at the moment CRepPartApp* pApp = (CRepPartApp*)AfxGetApp(); pApp->m_pDocManager->OnFileNew(); All the example's I can find deals with multiple document and views and switching between them. It is a new job and I'm feeling a bit incompetent:-O so any pointers would be much appreciated:) Grasp it but you cannot get it! It's name is memory..