Your product looks great, is there an example on how to hook it to a bdtree?
Thanks
Best regards,
Oleg Chernavin
MetaProducts corp.
>
> Your product looks great, is there an example on how to hook it to a bdtree?
>
> Thanks
Unfortunately, MetaTree has no built-in capabilities to work with
databases.
But you may implement this possibility yourself easily.
This is example from a real apllication which illustrates -
how to fill MetaTree with data from a database
===
procedure TForm1.ConstructTree;
var
Root: TMTNode;
// The tree structure stored in the table named "tree".
// This table consists of the following fields:
// [ID] [int] - unique record identifier.
// [ParentID] [int] - identifier of the parent node
// [Name] [char] (30) - Caption of the tree node
// [Icon] [smallint] - Icon index of the tree node
//
procedure FillTree(Const N: TMTNode; Const ParentID: Integer);
var
s: String;
i: Integer;
N1: TMTNode;
Temp: TList; // Stores list of all children of node N;
begin
with Query1 do
begin
SQL.Text :=
Format(`SELECT * FROM tree WHERE ParentID=%d`, [ParentID]);
Open;
Temp := TList.Create;
while not Eof do
begin
S := Trim(FieldByName(`Name`).AsString);
if s <> `` then
begin
N1 := MetaTree1.Items.Add(N, s);
with N1 do
begin
Data := Pointer(FieldByName(`ID`).AsInteger); // Save user-defined data
ImageIndex := FieldByName(`Icon`).AsInteger;
end;
Temp.Add(N1);
end;
Next;
end;
Close;
for i := 0 to Temp.Count - 1 do
FillTree(Temp[i], Integer(TMTNode(Temp[i]).Data));
Temp.Free;
end;
end;
begin
MetaTree1.BeginUpdate; // don`t repaint the Metatree
MetaTree1.Items.Clear;
// I added the root node manually, not from database
Root := MetaTree1.Items.Add(nil, `MetaTree`);
FillTree(Root, 0);
MetaTree1.EndUpdate; // It`s OK. Now we will repaint the MetaTree
end;
===