The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
  ActiveX Controls &nbsp
 Hierarchy Selector Control
 Easily Build Option Trees Like the IE's Advanced Options and Explorer's Folder Options


 NOTE: this code has been superceded by the version at the new site.



&nbsp

The Control as an Option Selector

Download the source code and binaries for the Hierachy Tree Selector control (110kb)
Download the TreeView Background Bitmap Class code (15kb)

&nbsp UpdatedUpdated! 25 August 1999 &nbsp
&nbsp Version 2.0 of the control adds the following:
  • Tile a picture into the TreeView background. This code is based on Ben Baird's TreeView background image sample. Visit his great website, VB Thunder.
  • Get/set item states using the new Value property
  • New Clear method to reset the content
  • &nbsp
    &nbsp Source Code Note &nbsp
    &nbsp This OCX is a binary compatible component which works with all other samples. If you compile your own copy of this OCX yourself please make sure you change the name. See disclaimer and license for more details. &nbsp
    &nbsp Before you Begin &nbsp
    &nbsp If you want to use background images, then the code requires the SSubTmr.DLL component. Make sure you have downloaded and registered this before trying the project. &nbsp

    Overview
    The Hierarchy Selector control is an enhanced COMCTL32.OCX TreeView control which allows you to easily create option dialogs like the Win98 Folder Options dialog and the Internet Explorer Advanced option dialog. In addition to this, it also provides methods which allow you display a hierarchy of options to the user and allow them to easily select the items of interest.

    The control also demonstrates how to do a number of other things with the TreeView control which aren't available in the standard version:

    • Make a Node Bold
    • Apply selection tracking (where a node highlights as the user moves the mouse over)
    • Get Full-Row selection in the treeview control
    • Make a Node look like it has been cut (dithered icon)
    • Change the background and foreground colours of the TreeView
    • Expand TreeView Nodes with a single click
    • Tile a bitmap into the background of the TreeView.

    Hierarchical Options
    Often there is a hierachy or drill-down in the data your user must choose from. For example, an application which allows users to choose from geographical regions could show a hierarchy like this:

    &nbsp Continents > Countries > Counties/States > Cities

    The idea of the hierarchical selector is to allow the user to select information at any level of drill-down from the top. So for the hierarchy above, if the user wanted to concentrate only on Liverpool in the UK, the User can eliminate a large number of unwanted cities at the continent level.

    To see this in pictures, the following sequence shows a selector for an imaginary banking application where data is categorised against a hierarchy of sectors.

    All Items Included
    All Items Included

    Clicking one item affects the children
    By clicking on the All Sectors item at the head of the list, the control automatically toggles all the children in the hierarchy. Likewise, if you were to click on the Banking sector, it would toggle all the state of all the children of the Banking sector.

    Demonstrating Partial Selections
    Clearly it is possible for certain children to be included and others to be excluded. When this occurs, the control correctly responds by indicating a partial selection in all the parents (in this case the Autos and Auto Parts and All Sectors items).

    Enjoy!
    This control has proved useful in my projects. Hope it is some use to you!

    &nbsp
    &nbsp


    TopBack to top
    Source Code - What We're About!Back to ActiveX Control Source Code
    Source Code - What We're About!Back to Source Code

    &nbsp


     NOTE: this code has been superceded by the version at the new site.



     

    About  Contribute  Send Feedback  Privacy

    Copyright © 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
    Last updated: 25 August 1999