Child within child?
-
I have a Doc/View application where I want to put a listview control in the CView derived class. Unforetunately I get the following error when the program runs : "Cannot create a top-level child window" on the two controls that I want in my CView derived class. Ex Defined in the MyView.h CListCtrl m_lstCtrl; In the OnCreate of CMyView m_lstCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(0, 120, 200, 200), this, 1); <-Error at this point. What would I be doing wrong? I was pretty sure I could put a child view inside of another childview. As a side note, If I change this to pParentWnd, the list control draws, but the CMyView draws over it. Cheers, Clint
-
I have a Doc/View application where I want to put a listview control in the CView derived class. Unforetunately I get the following error when the program runs : "Cannot create a top-level child window" on the two controls that I want in my CView derived class. Ex Defined in the MyView.h CListCtrl m_lstCtrl; In the OnCreate of CMyView m_lstCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(0, 120, 200, 200), this, 1); <-Error at this point. What would I be doing wrong? I was pretty sure I could put a child view inside of another childview. As a side note, If I change this to pParentWnd, the list control draws, but the CMyView draws over it. Cheers, Clint
I just created a brand-new SDI project, added the OnCreate handler to the view class, and then your code, and it works fine. I then tried it with a new MDI project and it also works fine. I suggest you try it yourself and check what the difference is. Regards, Alvaro
The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein