Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls


A tree list is not limited to a one-to-one correspondence. Not only can an item have more
than one dependency, but also a child can make the tree stop at any category. Categories
of a tree list are organized by levels. The most used trees have one parent. Here is an
example representing the world and some countries:

The children of a parent are recognized by their belonging to the same level but can have
different behaviors; for example, while one child might have another child (or other
children), an item on the same level does not necessarily abide by a set rule. Everything
usually depends on the tree designer.

The concept of a tree list is implemented in the MFC library by the CTreeCtrl. To create
a tree list on a dialog box or a form, at design time, on the Controls toolbox, click the

Tree Control button and click the desired area on a dialog box or a form:
Free download pdf