i:=0;
while i=0 do
begin
if IfHaveDate(node) then
i:=1
else
Node:=Node.Parent;
end;之所以那样写,是因为不明白你所说的数据是什么样的数据,所以
请你自己完成IfHaveDate这个函数啦
while i=0 do
begin
if IfHaveDate(node) then
i:=1
else
Node:=Node.Parent;
end;之所以那样写,是因为不明白你所说的数据是什么样的数据,所以
请你自己完成IfHaveDate这个函数啦
begin
TreeView1.Selected:=TreeView1.Selected.Parent;
ShowMessage(TreeView1.Selected.Text);
end;
ln:TTreeNode;
begin
ln:=treeview1.selected;
while ln.Level>=0 do
begin
if ln.data<>nil then
begin
showmessage('找到'+ln.text);
exit;
end;
ln:=ln.parent;
end;
if ln=nil then showmessage('找不到');
end;
begin
输入你的处理程序;
end;