0

I have an graphics MFC application which historically was developed by using a CTreeCtrl.
I want to add a CSplitterWnd to improve its graphical interface. However, I found that the CTreeCtrl is not compatible with CSplitterWnd. Apparently i must use a CTreeView.

CSplitterWnd m_wndSplitter;
// Runtime error on CreateView
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(myCTreeCtrl),CSize(100,100),pContext)) 

My problem:
If I switch to CTreeView, i must develop a lot of functions (example: SelectItem)

Question:
How can I switch easly from CTreeCtrl to CTreeView ? or can I for example insert a ctreectrl in a CFormview which will be used instead of CtreeView?

Alpha_33
  • 97
  • 8
  • I think you are on the wrong path here. Also I think you can add ctreectrl to splitter if you really want to and done right. To improve the UI try to play with the template projects. – darune Jun 10 '20 at 11:21
  • @darune ok, thanks. I will insist more on the use of `CTreeCtrl` – Alpha_33 Jun 10 '20 at 11:24

1 Answers1

1

The CTreeView class has member function CTreeCtrl& GetTreeCtrl() const. Replace all occurrences of

SelectItem(foo);

by

GetTreeCtrl().SelectItem(foo);
j6t
  • 9,150
  • 1
  • 15
  • 35