I am using TAdvTreeView. I am populatig the nodes in collection mode.
I am using TAdvTreeView. I am populatig the nodes in collection mode.
How do I get the nod text to show?
Populating:
procedure TfrmQTBugTracker_DM.FillBugsTree(var TV: TAdvTreeView);
var
i: Integer;
root, child: TAdvTreeViewNode;
begin
tv.beginupdate;
tv.columns.clear;
tv.columns.add.Text :='Tile';
tv.columns.add.Text :='Bug Data';
qryBugs.open;
while not qryBugs.eof do
begin
Root := TV.AddNode();//(
root.Text[0] := qryBugs.fieldByName('Title').asstring;
Child := TV.AddNode(Root);
Child.Text[0] := qryBugs.fieldByName('Owner').asstring;
TV.expandNode(root);
qrybugs.Next;
end;
qryBugs.close;
end;
Reading the Text:
procedure TfrmQTBugTracker_Main.tvBugsGetNodeText(Sender: TObject;
ANode: TAdvTreeViewVirtualNode; AColumn: Integer;
AMode: TAdvTreeViewNodeTextMode; var AText: string);
begin
AText := tvBugs.Columns[AColumn].Text;
end;
The treeview appears to be empty.
How do I get the nod text to show?
Populating:
procedure TfrmQTBugTracker_DM.FillBugsTree(var TV: TAdvTreeView);
var
i: Integer;
root, child: TAdvTreeViewNode;
begin
tv.beginupdate;
tv.columns.clear;
tv.columns.add.Text :='Tile';
tv.columns.add.Text :='Bug Data';
qryBugs.open;
while not qryBugs.eof do
begin
Root := TV.AddNode();//(
root.Text[0] := qryBugs.fieldByName('Title').asstring;
Child := TV.AddNode(Root);
Child.Text[0] := qryBugs.fieldByName('Owner').asstring;
TV.expandNode(root);
qrybugs.Next;
end;
qryBugs.close;
end;
Reading the Text:
procedure TfrmQTBugTracker_Main.tvBugsGetNodeText(Sender: TObject;
ANode: TAdvTreeViewVirtualNode; AColumn: Integer;
AMode: TAdvTreeViewNodeTextMode; var AText: string);
begin
AText := tvBugs.Columns[AColumn].Text;
end;
The treeview appears to be empty.
I solved my problem by copying the component's GetNodeText to my form.
ReplyDeleteprocedure TfrmQTBugTracker_Main.tvBugsGetNodeText(Sender: TObject;
ANode: TAdvTreeViewVirtualNode; AColumn: Integer;
AMode: TAdvTreeViewNodeTextMode; var AText: string);var
it: TAdvTreeViewNode;
begin
it := ANode.Node;
if Assigned(it) then
begin
if (AColumn >= 0) and (AColumn <= it.Values.Count - 1) then
AText := it.Values[AColumn].Text;
end;
end;