我做了个程序,采用Window explorer风格的,也是就是窗口左边部分是个CTreeView, 右边部分是个CListView.
在app类的InitInstance()中,有
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMyTreeView)); 很明显,通过document template 把Treeview和document关联起来了, 可以listview是如何和document关联在一起的呢?
我查看了一下MFC的代码,也没找到,
请明白人给讲解一下,谢谢了。
在app类的InitInstance()中,有
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMyTreeView)); 很明显,通过document template 把Treeview和document关联起来了, 可以listview是如何和document关联在一起的呢?
我查看了一下MFC的代码,也没找到,
请明白人给讲解一下,谢谢了。
发出GetDocument()->UpdateAllViews(),右边的listview的OnUpdate()方法就会响应,很明显两者是关联在一起的,但我找不到相应的代码,包括mfc源码上也没找到。
复制一些代码上来我们看看。可能listview是treeview的子窗口,所以
点击左边的treeview后,
发出GetDocument()->UpdateAllViews(),右边的listview的OnUpdate()方法就会响应