TreeNT - the new treeview control for Delphi 2 and 3
(might be working with BC++ too, but not tested)

Microsoft has introduced some very interesting new features for their
common controls since the Internet Explorer 3.0 was released. The version
4.0 of it brought even more and I implemented them into this component.

Despite the fact that Borland's implementation of TTreeView is actually
very slow, there are some additional things which will make your life
easier and your programs looking more professional. Below is a list of the
changes I made in TreeNT compared with TTreeView. Since some of the new
feature are available only if the correct version of COMCTL32.DLL is
installed, I marked their availability with (4.70), which corresponds
to IE 3 or the latest service packs; and 4.71 (IE4, Win98, WinNT 5.0),
respectively. Unmarked features are version independend.

That you understand me right, those properties are still there, even with IE2 or
Netscape Communicator installed, but won't work as expected. Since they are all
either message based or flags for the creation of the window, no crash of your
programs will occur, simply caused by the missing of the additional
features. I didn't implement the version control for COMCTL32.DLL yet, since
I haven't got Delphi 3.02 yet. Might be included in the next version.

Here now the list:

- TreeNT is a completely autarchic implementation and doesn't need the original
  TTreeView to work; now TTreeNT, TCustomTreeNT, TTreeNTNodes and TTreeNTNode
  are used instead of TTreeView, TCustomTreeView, TTreeNodes and TTreeNode to
  avoid naming conflicts
- an additonal unit CommCtrlEx.pas is included for types, consts and funcs,
  which are currently not in CommCtrl.pas (but will surely in some of the
  next relases of Delphi, then you can drop this unit)
- huge speed improvements for adding and removing items, there're now also
  the procedures BeginUpdate and EndUpdate in each TTreeNTNode
  (this was mainly implemented by Graham Wideman graham@sdsu.edu)
- new properties of TTreeNTNode:
    + property Checked: Boolean; (4.70) true, if check boxes are enabled and
      the item is checked, else false
    + property Color: TColor; (4.70) specifies the background color of the item
    + property Deleting: Boolean; for speed improvement, indicates that the item
      will be soon destroyed (avoids child updates)
    + property ExpandedOnce: Boolean; shows whether the item was expanded at
      least once
    + property Font: TFont; (4.70) the font and font color of the item
    + property ParentColor: Boolean; (4.70) true, if the background color of the
      treeview should be used, else false (Note: if this property is true then
      the item's background will track any color of the treeview)
    + property ParentFont: Boolean; (4.70) true, if the item's font is the same
      as the font in the treeview, else false (Note: the item's font will still
      follow the treeview, if ParentFont is true)
- new features of TCustomTreeNT (TTreeNT):
    + the treeview works now at design time too (including drag'n drop)
    + by deriving a component from TTreeNT, you can use it as designer in the
      IDE, because there's now a link to the form designer, which opens all
      the features you could need to maipulate other components at design time
      (see also property DesignerMode and Designer)
    + property AutoScroll: Boolean; true, if you want the content of the tree
      automatically scrolling up, down, left or right, when the mouse reaches
      the borders, else false
    + property Designer: TFormDesigner; (read only) useful only at design time;
      contains a link to the desginer of the form the tree is placed upon,
      this link is (at design time) always available, even if DesignerMode is
      false
    + property DesignerMode: Boolean; useful only at design time; true, if
      you want that the treeview treats eventually to TTreeNTNode.Data
      assigned values as components (with tests of course) and selecting
      them in the object inspector and (if they are visible) on the form,
      else false
    + property ItemHeight: ShortInt; (4.71) [-1,1..127], determines the height
      of all items in the tree (-1 stands for default height) in pixels
    + property Options: TTreeOptions; contains most of the treeview's
      appearence options (makes some splitted options of TTreeView obsolet):
        # toCheckBoxes (4.70): whether the tree has check boxes left to each
                               item or not (Note: this works with Images but
                               cannot be used, if the tree has StateImages!)
        # toFullRowSelect (4.71): determines whether the entire item row or only
                                  the text rectangle should take part in selection
        # toHideSelection: same as HideSelection of TTreeView
        # toHotTrack (4.70): determines whether the item label should get
                             underlined if the mouse hovers over it (just
                             like a link in the internet explorer)
                             (Note: this doesn't work if you have assigned
                                   an own font to an item)
        # toInfoTip (4.71): enables the OnHint event, to supply the user with
                            different hints for different nodes (Note: toToolTips
                            must be enabled as well to use this feature)
        # toNoScroll(4.71): hides the scroll bars in the tree, no scrolling possible
        # toReadOnly: same as ReadOnly in TTreeView
        # toToolTips (4.70): enables tool tips for the tree, that is, if an
                             item text is to long to fit into the client area,
                             the tree shows a small window with the complete
                             text, just like hints (Note: if toInfoTip is enabled,
                             this behavour is changed to support hints)
        # toShowButtons: same as ShowButtons in TTreeView
        # toShowLines: same as ShowLines in TTreeView
        # toShowRoot: same as ShowRoot in TTreeView
        # toSingleExpand (4.71): enables two feature at once, first, a node can
                                 be expanded with a single click instead of
                                 double click, and second, if a node looses the
                                 focus it is collapsed automatically (so only
                                 one item is expanded at a given time at the
                                 same level)
        # toWantReturn: enables advancing from node to node, if the user presses
                        the Enter key (wraps automatically from last node to
                        the first node)
      + property ScrollTime: Integer; (4.71) [1..Integer], determines the maximum
                             time in milliseconds a scroll operation should last
                             (doesn't determine the actual scroll time needed,
                              but the maximum limit)
      + property SearchString: String; if a tree has the focus and the user
                                       types letters, the tree automatically
                                       searches for a matching item, this
                                       property returns the string for this
                                       incremental search
      + event AfterPaint: TTVPaintEvent; (4.70)
                          called after the tree was entirely painted
        params:
          # Sender - the treeview
          # Canvas - a canvas to draw to (includes the entire client area)
      + event BeforePaint: TTVPaintEvent; (4.70)
                           called before any item has been drawn
        params:
          # Sender - the treeview
          # Canvas - a canvas to draw to (includes the entire client area)
      + event AfterItemPaint: TTVItemPaintEvent; (4.70)
                              called every time before an item is drawn
        params:
          # Sender - the treeview
          # Node   - the node clicked
          # Canvas - a canvas to draw to (includes the entire client area)
          # ItemRect - the item's rectangle in client coordinates (TRect)
          # NodeStates - provided to speed up state checking, contains:
              nsSelected, if Node is currently selected
              nsChecked, if check boxes are enabled and Node is checked
              nsFocused, if Node has the focus
              nsDisabled, if Node is disabled
              nsGrayed, if Node is grayed out
              nsHot, if hot tracking is enabled and the mouse hovers over Node
              nsIndeterminate, if state of Node is indeterminated
              nsMarked, if Node is marked (a user definable value, not implemented yet)
      + event BeforeItemPaint: TTVItemPaintEvent; (4.70)
                               called every time before an item is drawn
        params:
          # Sender - the treeview
          # Node   - the node clicked
          # Canvas - a canvas to draw to (includes the entire client area)
          # ItemRect - the item's rectangle in client coordinates (TRect)
          # NodeStates - provided to speed up state checking, contains:
              nsSelected, if Node is currently selected
              nsChecked, if check boxes are enabled and Node is checked
              nsFocused, if Node has the focus
              nsDisabled, if Node is disabled
              nsGrayed, if Node is grayed out
              nsHot, if hot tracking is enabled and the mouse hovers over Node
              nsIndeterminate, if state of Node is indeterminated
              nsMarked, if Node is marked (a user definable value, not implemented yet)
      + event OnDesignClick: TTVDesignClickEvent;
                             triggered if DesignerMode is true, this allows
                             to selectively enable or disable selecting a
                             component in the object inspector if the user
                             clicks on a node
                             (Note: this is only important for derived
                                    components and makes no sense with TTreeNT
                                    itself)
        params:
          # Sender - the treeview
          # Node   - the node clicked
          # var AllowSelect - set it to true, to allow interpreting Node.Data as
                              component (if not nil) and selecting it in the
                              object inspector
      + event OnHint: TTVHintEvent; (4.71)
                      called if toInfoTip and toToolTips are set in
                      Options and the tree is about to show the
                      hint window (Note: this is a function as event and you
                      should return the string to be shown in Result)
        params:
          # Sender - the treeview
          # Node   - the Node the mouse hovers over
          Result, a string with what is to be displayed, return Result:=''; if you
          don't want anything to display (no window appears then)
      + event OnSingleExpanding: TTVSingleExpandingEvent; (4.71)
                                 called if toSingleExpand is in Options and
                                 a node is about to be expanded
        params:
          # Sender - the treeview
          # Node   - the node clicked
          # AutoCollapse - true by default, set it to false to prevent the tree
                           from collapsing other expanded nodes automatically
      + method ShowInsertMark (4.71); shows the insert mark (a horizontal line,
                                      known from menus, whose entries are being
                                      dragged) or hides it
        params:
          # Node - the node, where the mark should be placed
          # After - true, if the mark is to be placed below Node;
                    false, if the mark is to be placed above Node

As you can see, there are lots of new things implemented, but you can also
see (in the header of TreeNT.pas), that some of other features aren't.
That is, because I either couldn't get more information about a specific
item or found it useless for the time being.

This software is freeware and might be used in any other free software
(thus excludes shareware), whithout any guarantee or responsibility
of the author.

The TNTEditor contains another freeware component, not written by me,
called TToolbarButton97. Credits go to Jordan Russell (jordanr7@aol.com).

-----------------------------------------------------------------------------

Written by Dipl. Ing. Mike Lischke (Dresden, Germany, Nov. 1997)

Lischke@hotmail.com
