Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. The TreeView and ListView Controls

Chapter 9. The TreeView and ListView Controls

In Chapter 6, "Basic Windows Controls," you learned how to use the ListBox control for displaying lists of strings and storing objects. The items of a ListBox control can be sorted, but they have no particular structure. I'm sure most of you wish that the ListBox control had more "features," such as the means to store additional information along with each item or to present hierarchical lists. A hierarchical list is a tree that reflects the structure of the list: items that belong to other items appear under their parent with the proper indentation. For instance, a list of city and state names should be structured so that each city appears under the corresponding state.

The answer to the shortcomings of the ListBox control can be found in the TreeView and ListView controls. These two Windows controls are among the more-advanced ones, and they are certainly more difficult to program than the ones discussed in the preceding chapters. These two controls, however, are the basic makings of unique user interfaces, as you'll see in this chapter's examples. The TreeView and ListView controls implement two of the more-advanced data structures and were designed to hide much of the complexity of these structures — and they do this very well.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint