关于TreeView

ysx192 2006-10-19 02:05:30
if AdoTree.Active and (AdoTree.RecordCount > 0) then
begin
AdoTree.First;
curNode := nil;
curid := -1;
fcTreeView.Items.Clear;
while not AdoTree.Eof do begin
New(curValue);
curValue^.deptid := AdoTree.fieldByName('DeptID').AsInteger;
curValue^.name := AdoTree.fieldByName('DeptName').AsString;
curValue^.pdeptid := AdoTree.fieldByName('ParentID').AsInteger;
/////////////////////////////////////////////////////////////////
IsFind := True;
if curValue^.deptid < -1 then Curid := -1;
while (curid <> curValue^.pdeptid) do
begin
if curid = -1 then begin
curid := curValue^.pdeptid;
end else begin
curNode := curnode.Parent;
curid := IndexPointer(curNode.Data)^.deptid;
end;
end;
////////////////////////////////////////////////////
if curValue^.deptid > -1 then begin
curNode := fcTreeview.Items.AddChildObject(curNode,curValue^.name,curValue);

end else begin
curNode := fcTreeView.Items.AddChildObject(nil,curValue^.name,curValue);
end;
/////////////////////////////////////////////////////
Curid := IndexPointer(curNode.Data)^.deptid;
// AdoTree.Next;




AdoTree.Next;

end;
end; }


当在{ while (curid <> curValue^.pdeptid) do
begin
if curid = -1 then begin
curid := curValue^.pdeptid;
end else begin
curNode := curnode.Parent;
curid := IndexPointer(curNode.Data)^.deptid;
end;
end;
}中读取到的AdoTree中的数据在 fcTreeView中找不到父结点时就会出错,怎么解决
...全文
151 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
leizhen2004 2006-10-20
  • 打赏
  • 举报
回复
路过顶
dashi 2006-10-19
  • 打赏
  • 举报
回复
友情up
ysx192 2006-10-19
  • 打赏
  • 举报
回复
求解决的源码

828

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧