LMuadDIb
asked on
count a treeview root items
hey all,
anyone have a function that can count the root items in a treeview?
not the total item count, I dont want to count the children....
anyone have a function that can count the root items in a treeview?
not the total item count, I dont want to count the children....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
another possibility (just from head, not tested)
function countChilds(ATree : TTreeView;ANode : TTreeNode) : Integer;
var
CNode : TTreeNode;
begin
result := 0;
if ANode = Nil then
CNode := ATree.Items.GetFirstNode
else
cNode := ANode.GetFirstChild;
if assigned(CNode) then
begin
while assigned(CNode) do
begin
result := result +1;
cNode := cNode.GetNextSibling;
end;
end;
end;
meikl ;-)
function countChilds(ATree : TTreeView;ANode : TTreeNode) : Integer;
var
CNode : TTreeNode;
begin
result := 0;
if ANode = Nil then
CNode := ATree.Items.GetFirstNode
else
cNode := ANode.GetFirstChild;
if assigned(CNode) then
begin
while assigned(CNode) do
begin
result := result +1;
cNode := cNode.GetNextSibling;
end;
end;
end;
meikl ;-)
Thanks for the points :)
I beat the mighty kretzschmar ;-p) he he ;)
David
I beat the mighty kretzschmar ;-p) he he ;)
David
:-))
i posted my suggestion already after you got the grade, david,
so you was never in danger :-))
btw. i'm not mighty, i'm just a simple coder
meikl ;-)
i posted my suggestion already after you got the grade, david,
so you was never in danger :-))
btw. i'm not mighty, i'm just a simple coder
meikl ;-)
lol ;P
David