Subject | Re: [IBO] Anybody know how to use or work with IB_Treeview component? |
---|---|
Author | Markus Ostenried |
Post date | 2012-04-23T19:10:10Z |
Hi,
I just have an older version of IBO4 here and I just used the treeview
from IB_VTree.pas in my projects (it uses TVirtualTree,
http://www.delphi-gems.com/index.php/controls/virtual-treeview which
has much more features, is faster but also more complex).
That being said I just looked at IB_TreeView.pas and I think I can
guess how to use it :)
You need to create a dataset component (e.g. TIB_Query) which fetches
your records, assign this component to the treeview's dataset
property. The fetched records need at least a few columns which you
assign to these treeview properties:
- Field_Key: column containing a unique value identifying a record,
probably the primary key of the table you're selecting from.
- Field_Master: this column contains the key of a node's parent. Think
of it as being a foreign key referencing Field_Key to establish a
parent relation.
- Field_Data: this column contains the text being displayed for each node.
Note that TIB_TreeView loads all nodes (records) at once in its
LoadData method (look at this method to understand what I guessed
about properties/columns above). So if you have a lot of data you
might want to look at IB_VTree mentioned above. That one is event
driven and will call an event method for every node which allows you
to tell the treeview control how many children a given node has. Once
that node is expanded another event will be raised in which you have
to load the child nodes yourself. This is a bit more complicated but
saves a lot of resources.
Also I think there was/is a limitation of the tree control from which
TIB_TreeView inherits which forces a nodes text to be at most 260
characters (MAX_PATH) long. Not sure if this is still true, you might
want to test that yourself.
HTH,
Markus
On Mon, Apr 23, 2012 at 19:45, Carlos Daniel
<carlosdaniel_am@...> wrote:
I just have an older version of IBO4 here and I just used the treeview
from IB_VTree.pas in my projects (it uses TVirtualTree,
http://www.delphi-gems.com/index.php/controls/virtual-treeview which
has much more features, is faster but also more complex).
That being said I just looked at IB_TreeView.pas and I think I can
guess how to use it :)
You need to create a dataset component (e.g. TIB_Query) which fetches
your records, assign this component to the treeview's dataset
property. The fetched records need at least a few columns which you
assign to these treeview properties:
- Field_Key: column containing a unique value identifying a record,
probably the primary key of the table you're selecting from.
- Field_Master: this column contains the key of a node's parent. Think
of it as being a foreign key referencing Field_Key to establish a
parent relation.
- Field_Data: this column contains the text being displayed for each node.
Note that TIB_TreeView loads all nodes (records) at once in its
LoadData method (look at this method to understand what I guessed
about properties/columns above). So if you have a lot of data you
might want to look at IB_VTree mentioned above. That one is event
driven and will call an event method for every node which allows you
to tell the treeview control how many children a given node has. Once
that node is expanded another event will be raised in which you have
to load the child nodes yourself. This is a bit more complicated but
saves a lot of resources.
Also I think there was/is a limitation of the tree control from which
TIB_TreeView inherits which forces a nodes text to be at most 260
characters (MAX_PATH) long. Not sure if this is still true, you might
want to test that yourself.
HTH,
Markus
On Mon, Apr 23, 2012 at 19:45, Carlos Daniel
<carlosdaniel_am@...> wrote:
> Hi friends,
>
> I am looking for a demo how to use ib_treeview or some documentation.. does anybody has anythings about ib_treeview".
>
>
> I'm trying to create a tree view of a product. With the structure in the component treeview.
>
> Thanks
> Carlos Daniel
>
>
>
> ------------------------------------
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more ! Yahoo! Groups Links
>
>
>