3

I need to implement TreeList control same as in Process Explorer. I am quite newbie in GUI and did not write such complicated controls.

As I see in Process Explorer, there is a TreeListWindowClass, which contains children: 2 headers, 3 scrollbars (one of them is invisible?) and 1 static (place between visible scrollbars). As I understand, main control draws all items inside itself. Also I did not found mfcxxx.dll in attached dlls.

Question 1: what framework it’s better to use? There are: MFC, WTL, plain WinAPI … I took a look at this implementation http://www.codeguru.com/cpp/controls/treeview/classes/article.php/c13167 and was confused with > 8000 lines of code in cpp file with huge structures (one of them contains 80 members). It is plain WinAPI (and C without ++). I definitely want to use OOP style. =)

Question 2: What is the high-level design of this control should be? Can you explain without deep details how does this control should be designed?

My limitations: C++, VS10, OS: Vista and higher.

Thanks in advance

ToughDev
  • 117
  • 1
  • 5
  • There is no TreeList control in those class libraries. Mark Russinovich made his own. 8 KLoc sounds about right, it isn't a simple control. It is a popular offering for 3rd party tool vendors. Finding one written in C++ is going to be tricky. – Hans Passant Mar 22 '11 at 01:33
  • I don't think I've ever seen a native one, publicly available for sale, written in C++. I've seen plenty of managed ones though. – C.J. Mar 22 '11 at 09:49
  • Hans, the problem is not 8KLoc, but old style of programming. I have not much knowledge yet about creating own controls. So I prefer to learn creating them in a modern way (using classes, not plain C). GrahamS gave me excellent starting point. – ToughDev Mar 22 '11 at 10:49

4 Answers4

3

I did this recently and used the Multi-Column Tree View from http://www.mimec.org/articles/mfc/mctree

Screenshot of Multi-Column Tree View

It is fairly basic, but it met my needs and is fairly compact. It provides a CColumnTreeView class which is a sub-class of CView - so it works correctly with the standard CDocument/CView pattern of MFC.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
GrahamS
  • 9,980
  • 9
  • 49
  • 63
  • You're welcome! Only potential gotcha I have encountered is that the `CView::OnInitialUpdate()` method will call `yoursubclass::OnUpdate()` before `CColumnTreeView::OnInitialUpdate` has completed - so the result of `GetTreeCtrl()` is not valid on the first call to your `OnUpdate` - easy to protect against by adding `if (GetTreeCtrl().m_hWnd == NULL) return;` – GrahamS Mar 22 '11 at 11:01
2

You can find the exact equivalent of Process Explorer's "Tree List View" from Process Hacker's source (which is a lot better IMHO.)

user541686
  • 205,094
  • 128
  • 528
  • 886
0

Qt is a library that offers a fully functioning QTreeWidget that looks like it meets the requirements of your program.
enter image description here

Tom
  • 908
  • 1
  • 6
  • 14
  • 2
    That looks like a Tree control, NOT a treelist control. A treelist control is the combination of a tree control and a listview or grid control. – C.J. Mar 22 '11 at 09:50
  • the screenshot looks like that, but qtreewidget supports this as well http://www.civilnet.cn/book/embedded/gui/qt4/images/settingsviewer.jpg – Tom Mar 22 '11 at 12:35
0

DevExpress has some excellent treelist controls, however they are written in C#. However you can target them using C++/CLI, or managed C++. So I'm not sure if you are able to make your app managed. So perhaps it might not be so helpful.

As for free treelist controls, I try to stay away from them, due to bugs, and lack of support.

C.J.
  • 15,637
  • 9
  • 61
  • 77