///
//函数名:of_tv_findITem
//功 能:根据data或label值查找节点位置,通过树的深度优先算法来实现
//参 数:treeview - tv_tree 进行操作的TreeView
// boolean - findby True-根据data查找;False-根据label查找
// string - data 要查找的label或data的值
//返回值: long - 找到的handle,没找到返回0 出错返回-1
long ll_hdl[]
integer li_cnt
treeviewITem lt_tvi
li_cnt = 1
//当前节点CurrentTreeITem!, 全部节点RootTreeITem!,
ll_hdl[1] = tv_tree.FindItem(RootTreeITem!, 0)
do while li_cnt > 0
if tv_tree.GetITem(ll_hdl[li_cnt], lt_tvi) = -1 then return -1
if ll_hdl[1] <> ll_hdl[li_cnt] then
if findby then
if string(lt_tvi.data) = data then return ll_hdl[li_cnt]
else
if string(lt_tvi.label) = data then return ll_hdl[li_cnt]
end if
end if
if lt_tvi.children then
li_cnt ++
ll_hdl[li_cnt] = tv_tree.FindItem(ChildTreeITem!, ll_hdl[li_cnt - 1])
else
ll_hdl[li_cnt] = tv_tree.FindItem(NextTreeITem!, ll_hdl[li_cnt])
end if
do while ll_hdl[li_cnt] <= 0
li_cnt --
if li_cnt = 0 then exIT
ll_hdl[li_cnt] = tv_tree.FindItem(NextTreeITem!, ll_hdl[li_cnt])
loop
loop
return 0