Trees

A tree control allows the user to inspect, manipulate or select from a hierarchichal list of items. Trees may have one or more columns, and contain text, graphics, simple controls, or a combination of all three.

Use trees with care!

Because of their complexity compared to other controls, novice and some intermediate users often have problems using and understanding tree controls. If your application is designed for that type of user, you might want to consider alternative ways of presenting the information, such as the Nautilus list or icon view, or the hierarchical browser lists found in GNUstep's File Viewer.

Figure 6-21A simple tree control with one level of hierarchy
Guidelines
  • Always give tree controls a label, positioned above or to the left of the tree, in sentence capitalization. Provide an access key in the label that allows the user to give focus directly to the tree.

  • Use column headers when:

    • the tree has more than one column
    • the tree has only one column, but the user may wish to re-order the tree. This should rarely be true of single column trees.

    In most other situations, column headers take up unnecessary space, and the extra label adds visual clutter.

  • Always label column headers when used. If the column is too narrow for a sensible label, provide a tooltip for the column instead. Apart from its obvious use, this will help ensure that assistive technologies can describe the use of the column to visually impaired users.

  • Consider using a check box tree for multiple-selection trees, as these make it more obvious that multiple selection is possible:

    Figure 6-22A simple check box tree

    If you do this, you should normally set the tree control itself to be single-selection, but this depends on the particular task for which it will be used.

  • For multiple selection trees, show the number of items currently selected in a static text label below the tree, for example, Names selected: 3. Such a label also makes it more obvious that multiple selection is possible.

  • Consider providing Select All and Deselect All buttons beside multiple selection trees, if appropriate to the task.

6.15.1. Sortable Trees

As with lists, the user may find it useful to sort long or multi-column trees. See the guidelines in Section 6.14.1 ― Sortable Lists for more information.