Home > database >  The warrior, please give directions! About the treeview
The warrior, please give directions! About the treeview

Time:10-06

Run time has been expression is not valid!
Know what went wrong, please give directions!!!!!!

Long rows, the I, cur_len, p
String mycode, STR, myname, where
Long handle_current, h1
Treeviewitem item
Treeviewitem newitem

//find the handle to the current node
H1=tv_1. Finditem (currenttreeitem! , 0)

//handle to find the child node
Handle_current=tv_1. Finditem (childtreeitem! , h1)

//the current node without children
If handle_current & lt; 0 then
Tv_1. The getitem (h1, item)
Where=item. The label//text of the current node where
P=pos (where, "-")
Mycode=mid (where, 1, p - 1)//the current node code mycode
Cur_len=len (mycode)//the length of the current node code mycode
//list starting with mycode record, because the lower nodes are mycode beginning
STR="id like '" + mycode + %
Dw_1. Setfilter (STR)
Dw_1. Filter ()
Rows=dw_1. Rowcount ()

For I=1 to rows//insert the lower node
Mycode=dw_1. Getitemstring (I, "no")
Myname=dw_1. Getitemstring (I, "name")//read the data from the data window

If len (mycode)=cur_len + 2 then//at a lower level node length is larger than the parent node 2
Newitem. Label=mycode + "--" + myname//new node title
Newitem. Pictureindex=(cur_len + 2)/2 + 1//new node picture
Newitem. Selectedpictureindex=(cur_len + 2)/2 + 2
Tv_1. Insertitemlast (h1, newitem)//add a new node
End the if
Next
End the if
Tv_1. Expanditem (h1)
return 0

CodePudding user response:

STR="id like '" + mycode + %
Modified to
STR="id like '%'" + mycode + ", "

  • Related