Dialogs.TreeViews
The functionality of this package is similar to that of Dialogs.ListBoxes.  A tree view control is used instead of a list box.

Changing Colors
All the techniques used in edit or list boxes do not work at all for TreeViews.  There is no owner draw and ColorHandler is never invoked.  Those guys in Redmond just do not know the meaning of the word "consistency".  It is however, extremely simple to change the text and background colors.  Just use the following calls:

OS.Windows.Controls.TreeViews.SetTextColor and
OS.Windows.Controls.TreeViews.SetBackgroundColor!

Only if all other controls were this simple.  Highlighting a selected item proved to be problematic.  Changing system colors would be the simplest way if not for the undesirable global effect.  To get highlighted coloring, the tree view control must be subclassed to intercept the left button down and up messages in the derived mouse handler of the subclass package.  With this drag and drop of a tree items can be implemented in here as well.  The highlighted item is reverted to its original default colors when the mouse is moved. Therefore the highlighted item has to be drawn again with the desired colors in SetCursorHandler.

The footprint drawn by my text drawing routine is slightly smaller than the one draw by the system.  Could not understand why this is happening.  Rather than fighting with the
way Windows wants things to be done, a frame border is drawn around the highlighted item.  By using appropriate colors, the remnant areas can be hidden away.  A light border color around a dark background usually works well.  For example a light yellow border with a dark blue background.  Using custom draw do not work when the tree view control is created by dialog template.

Handlers

procedure CreateSubitemHandler(Container      : in out Containers;
                                                     TreeView       : OS.Windows.Controls.TreeViews.Controls'Class;
                                                     CreatedItem  : OS.Windows.Controls.TreeViews.Items);
--
-- Actions to be taken when an item is created.
-- 

procedure DeleteItemHandler (Container             : in out Containers;
                                                 TreeView             : OS.Windows.Controls.TreeViews.Controls'Class;
                                                 ItemToBeDeleted : OS.Windows.Controls.TreeViews.Items);
--
-- Actions to be taken when an item is about to be deleted.
--

procedure ExtendContextMenuHandler(Container       : in out Containers;
                                                              ContextMenu : OS.Windows.Menus.Menus'Class;
                                                              TreeView       : OS.Windows.Controls.TreeViews.Controls'Class;
                                                              CanBeEdited  : boolean);
--
-- Extending the context menu.  CanBeEdited refers to the editablity of the dialog box.
--

procedure ExtendControlHandler(Container   : in out Containers;
                                                    Control       : OS.Windows.Ops.Windows'Class;
                                                    ControlID   : OS.IDs;
                                                    Notification : OS.Windows.Notifications);
--
-- Actions to be done when Control is activated.  Notification contains additional information that is
-- sent by RouteToControlHandler.
--

procedure ExtendMainMenuHandler(Container     : in out Containers;
                                                         MainMenu    : OS.Windows.Menus.Menus'Class;
                                                         CanBeEdited : boolean);
--
-- This is where additional main menu items can be defined.  CanBeEdited refers to the global
-- editiability of the dialog box.
--

function ExtendTemplateHandler(Container : Containers)
              return OS.Windows.Controls.Templates.Templates;
--
-- This is where additional controls may be defined.
--

procedure ExtendMenuItemIdHandler(Container : in out Containers; MenuItemID : OS.Ids);
--
-- Actions to be taken when a menu option is selected.  It may come from the main menu or the
-- context menu.
--

function FormattedTextHandler(Container : Containers; RawInputText : Wide_String)
              return Wide_String;
--
-- Transform RawInputText into a formatted form for display.  By default, nothing is changed.
--

procedure InputMouseHandler(Container : in out Containers;
                                                TreeView  : OS.Windows.Controls.TreeViews.Controls'Class;
                                                Event        : OS.Mouse.Events;
                                                State         : OS.Mouse.States;
                                                Point         : OS.Points.Points;
                                                Handled     : out boolean);
--
-- Actions to be taken when clicking a mouse button while an item is being edited.
--

procedure InputValidationHandler(Container        : in out Containers;
                                                      EditBox            : OS.Windows.Controls.EditBoxes.Controls'Class;
                                                      RawText           : Wide_String;
                                                      FormattedText : Wide_String;
                                                      Accepted          : out boolean;
                                                      ErrorMessage   : out awStrings.awStrings);
--
-- Checks RawText/Formatted  is invalid or not.  If so, Accepted is true.   ErrorMessage is used to
-- indicate the reason for the error.
--

procedure LoadTreeViewHandler(Container : in out Containers;
                                                     TreeView : OS.Windows.Controls.TreeViews.Controls'Class;
                                                     Loaded    : out boolean);
--
-- Specifies how a tree view is to be loaded.
--

procedure PostDisplayActionHandler(Container : in out Containers;
                                                          TreeView  : OS.Windows.Controls.TreeViews.Controls'Class);
--
-- Actions to be taken after the dialog box and all its controls are being made visible.
--

procedure RenameItemHandler(Container               : in out Containers;
                                                  TreeView                : OS.Windows.Controls.TreeViews.Controls'Class;
                                                  ItemToBeRenamed : OS.Windows.Controls.TreeViews.Items;
                                                  OldName                 : Wide_String;
                                                  NewName                : Wide_String;
                                                  CanBeRenamed      : out boolean);
--
-- Actions to be done when an item is being renamed.  CanBeRenamed indicates whether
-- ItemToBeRenamed is possible.
--

procedure SelectionHandler(Container     : in out Containers;
                                            TreeView      : OS.Windows.Controls.TreeViews.Controls'Class;
                                            OldItem        : OS.Windows.Controls.TreeViews.Items;
                                            SelectedItem : OS.Windows.Controls.TreeViews.Items);
--
-- Actions to be done when an item is selected.  OldItem is the previously selected item.
--

procedure SaveTreeViewHandler(Container : in out Containers;
                                                    TreeView : OS.Windows.Controls.TreeViews.Controls'Class;
                                                    Saved       : out boolean);
--
-- Specifies how a tree view control is saved.

Dialogs.Folder
s
Hom
e
Back To Dialogs.Columns