Home | Download | Buy | Register Help | Contact | Links

AczDbTreeView 1.0

Documentation

AczDbTreeView component, version 1.0

Shareware

(C) Copyright 2001, John Zhou

Email: zjrnet@yahoo.com


Contents

  • Software License Agreement
  • Detailed Features
  • How to use the component
  • Install the component
  • Component Interface
  • Attention

  • Software License Agreement

    ALLOWED:

    AczDbTreeView is a shareware, You can use it for commercial freely after you've bought it. Download and Buy Now

    NOT ALLOWED:

    1. Forbidden to sell AczDbTreeView component or sell in other name.

    2. Forbidden to Licensed to any other person.


    Detailed Features

    The AczDbTreeView 1.0 provides you with a powerful and easy-to-use tree component for the display of recursive data in an application. The AczDbTreeView 's distinct improvement from the common TreeView component in Delphi is those features described below:

    (1) DB-Aware

    To set the properties of the AczDbTreeView component below:

    you are on your way to attach every tree node in the AczDbTreeView control to one record of a table in your own database. When a tree node is added, deleted, moved or edit in the AczDbTreeView control, the record attached to it will vary with it in your database at the mean time.

    And you are able to load the entire tree with its node IDs, expanded status, images from your database.

    (2) Support all DBMS

    Because an AczDbTreeView control is attached to a database through the 'DataSource' property, it has no relation with the DBMS. Your database can be a local one, such as Paradox, Dbase, Access or Sybase SQL Anywhere, even a text file. And your database can also be a Client/Server one accessed via network, such as Sybase SQL Server, MS SQL Server, Oracle, DB2, Informix, mSQL etc.

    (3) Copy, Cut and Paste Nodes

    Within an AczDbTreeView control, you can copy or cut any node with all its children, and paste them anywhere in the control. The data in your database will automatically vary with the change of the tree structure.

    (4) Tree node's ID

    The AczDbTreeView control will automatically attach a unique ID of integer type to every tree node.

    When a tree node is created in AczDbTreeView control, an internal ID is automatically attached to it, and this ID is unique wherever this tree node is moved in the control.

    (5) Getting ID of every tree node

    You can get any tree node's ID in the AczDbTreeView control at anytime.The method is quite simple, just to call the function of AczDbTreeView.GetNodeID with the parameter of a tree node which ID you want to know.

    (6) Getting Path of every tree node

    You can get any tree node's PATH from the root of the tree when you call the function of AczDbTreeView.GetPath with the parameter of a tree node. A tree node's PATH is a string like "Root->Web sites->Search Engines->Yahoo".


    How to use AczDbTreeView in your application

    In short, if you have a need to represent self-referenced data structures within your application, there is no substitute for the AczDbTreeView and other products in the series of Acz TreeView like components.

    The core design principle behind the AczDbTreeView component is that of simplicity.

    Here are the steps to use the AczDbTreeView:

    (1) In your own database, create a table in witch there must exist demanded special fields below, and there are all other fields defined by yourself refering to detailed information about the tree node.

    Field Name Type Key Field Memo
    ID Int Yes Refer to the tree nodes' IDs. Must be the only key field of this table.
    NodeText Char(30) no Refer to the tree nodes' texts.
    ParentID Int no Refer to the parent node's ID of this tree node.
    Expanded Char(1) no Refer to the expanded status of this tree node.
    ImageIndex Int no Refer to the image shown on left of this tree node.
    SelectedIndex Int no Refer to the image shown on left of this tree node when it is selected.

    (2) On your form, created a DataSource control which links to the database that you specified to store the data of the AczDbTreeView control..

    (3) Set the properties of the AczDbTreeView component on your form below:

    Property Name Type Value Description
    DataSource TDataSource The name of the DataSource control that you created to store the data of the AczDbTreeView control.
    IDFieldName String Name of the "ID" field in the table mentioned above.
    NodeTextFieldName String Name of the "NodeText" field in the table mentioned above.
    ParentIDFieldName String Name of the "ParentID" field in the table mentioned above.
    ExpandedFieldName String Name of the "Expanded" field in the table mentioned above.
    ImageIndexFieldName String Name of the "ImageIndex" field in the table mentioned above.
    SelectedIndexFieldName String Name of the "SelectedIndex" field in the table mentioned above.

    Your table must include these fields mentioned above.

    (4) Call the function AczDbTreeView.EnableDataLink to enable the link between the AczDbTreeView control and your database. If you call this function at the start of your program and there are records in your table referring to the tree nodes' information, then all tree nodes will be seen within the AczDbTreeView control.

    (5) Operate the tree nodes in the AczDbTreeView control according to your need: add, delete, move, edit, copy, cut or paste nodes. And the records in your table will vary with the tree nodes.

    Ultimately, the AczDbTreeView works very much like a common TreeView. It supports all of the Properties, Events, and Methods of a standard TreeView control. You can easily add, edit, move, delete and drag tree nodes. The AczDbTreeView handles all other chores and responsibilities behind the scenes to eliminate any and all difficulties you would normally face when binding data to a common TreeView control and saving and loading a common one.


    Install the component

    The component can be used after installing it the normal way in Delphi 4. Someone told me it also works for Delphi 5 and I guess it will also work for Delphi 3 and would appreciate when somebody can mail me if it indeed works. Please ignore the compile hints.

    To install (Delphi 4):

    Just unpack the zip-file into a directory where you want to keep your components.

    Then choose the menu [Component],[Install Packages], in the new window click the [Add] button, and select the file 'AczDbTV.bpl'. Then click the [OK] button. The component will be placed under [samples].


    Component Interface

    Properties

    Property Name Type Description
    DataSource TDataSource The name of the DataSource control that you created to store the data of the AczDbTreeView control.
    IDFieldName String Name of the "ID" field in the table mentioned above.
    NodeTextFieldName String Name of the "NodeText" field in the table mentioned above.
    ParentIDFieldName String Name of the "ParentID" field in the table mentioned above.
    ExpandedFieldName String Name of the "Expanded" field in the table mentioned above.
    ImageIndexFieldName String Name of the "ImageIndex" field in the table mentioned above.
    SelectedIndexFieldName String Name of the "SelectedIndex" field in the table mentioned above.

    Functions and Procedures

    Function and Procedure Function Description
    procedure EnableDataLink; Make the AczDbTreeView control link and aware to the user's database.
    function GetNodeID( Node: Ttree node ): integer; Return the unique ID of the tree node specified by the parameter.
    function GetPath( Node: Ttree node ): string; Return the path from root of the tree downto the tree node specified by the parameter, including all ancestors of this tree node.
    function AddNewNode( Node: Ttree node; Text: string; ImageIndex: integer; SelectedIndex: integer): Ttree node; Add a new tree node as a child of the tree node specified by the parameter "Node". And the "Text" property of the new tree node is the same as the parameter "Text". This function return the new tree node created.
    function AddRoot( Text: string; ImageIndex: integer; SelectedIndex: integer): Ttree node; Add the unique root node of the tree. The "Text" property of the root node is the same as the parameter "Text". This function return the new tree node created.
    procedure CutNode; Cut the current selected node with all its children to the internal clipboard of the AczDbTreeView control.
    procedure CopyNode; Copy the current selected node with all its children to the internal clipboard of the AczDbTreeView control.
    procedure PasteNode; Paste the nodes in the internal clipboard to the current selected node.
    procedure RegisterAcz( SerialNumber: string, ActiveKey:string ); Register the AczDbTreeView component.

    Events

    Event Description
    OnIOError Occurs if there's some error in openning,closing,reading or writing the file when you call one of the procedures:SaveTree, LoadTree and LoadExpandedTree.
    OnMemError Occurs if there's some error in operating the treeview.
    OnDbError Occurs if there's some error in operating the user's database.
    OnAczChanged Occurs if one node is changed in the AczDbTreeView control.
    OnAczEdited Occurs if one node is edited in the AczDbTreeView control.
    OnAczExpanded Occurs if one node is expanded in the AczDbTreeView control.
    OnAczDeleted Occurs if one node is deleted in the AczDbTreeView control.
    OnAczCollapsed Occurs if one node is collapsed in the AczDbTreeView control.

    Attention

    (1) In the AczDbTreeView control, every tree node's ID is attached to the property "Data". Don't try to access "Data" property of every tree node.

    (2) The "ID" field of your table must be the only key field.

    (3) Except the six fields that demanded by AczDBTreeView, all other fields defined by yourself in your table must have default values.

    (4) If your datasource is read-only, you are not able to create or change any tree node in the AczDBTreeView control.


    Home | Download | Buy | Register Help | Contact | Links