Home > database >  PB generated tree
PB generated tree

Time:10-13

PB generated tree structure, and can be similar to the resource manager, and drag and drop the node, on any branch? Is there a similar example code?

CodePudding user response:

Drag can be, but need to write their own code

CodePudding user response:

Refer to the code below

In the event of an dragdrop:

Long ll_NewItem
TreeViewItem ltvi_Target//target
TreeViewItem ltvi_Source//source
TreeViewItem ltvi_Parent//parent node
TreeViewItem ltvi_New
Dec lc_id
Dec lc_pid
String ls_sql

If the GetItem (il_DropTarget ltvi_Target)=1 Then Return
If the GetItem (il_DragSource ltvi_Source)=1 Then Return
Lc_id=dec (ltvi_Source. Data)
Lc_pid=dec (ltvi_Target. Data)
SetDropHighlight (0)

The GetItem (il_DragParent ltvi_Parent)

If messagebox (" ", "are you sure you mobile" + & amp;
Ltvi_Source. + "from" + ltvi_Parent Label. The Label + "to" + ltvi_Target. The Label + & amp;
"?" That Question! YesNo! , 1)=2 Then Return

Ls_sql="update" + is_tablename + & amp;
"The set pid=" + string (lc_pid) + & amp;
"Operator=" + string (gc_userid) + & amp;
"Where id=" + string (lc_id)
The execute immediate: ls_sql;
////messagebox (" ", ls_sql)
//update sys_org
//set the pid=: lc_pid
//the where id=: lc_id using sqlca;
If the sqlca. Sqlcode & lt;> 0 then
The rollback.
Messagebox (" ", "update institutions failed! 9 "+ sqlca. Sqlerrtext stopsign!)
Gf_writeerrors ()
Return
The else
//commit;
Long res
Res=parent. Of_changecode (lc_id lc_pid)
If res & lt;> 1 then
commit;
Called DeleteItem (il_DragSource)
SetNull (ltvi_Source ItemHandle)
Ltvi_New. Data=https://bbs.csdn.net/topics/ltvi_Source.data
Ltvi_New. Label=ltvi_Source. Label
Ltvi_New. Pictureindex=ltvi_Source. Pictureindex
Ltvi_New. Selectedpictureindex=ltvi_Source. Selectedpictureindex
Ltvi_New. Children=ltvi_Source. Children
Ll_NewItem=InsertItemSort (il_DropTarget ltvi_New)
SelectItem (ll_NewItem)
The else
The rollback.
Messagebox (" ", "update failed!" , stopsign!)
Gf_writeerrors ()
Return
End the if
end if

CodePudding user response:

I copied in the past, the debug can be?

CodePudding user response:

Of_changecode gf_writeerrors (), the two function can stick out

CodePudding user response:

reference 4 floor bedsb response:
gf_writeerrors (), of_changecode this two function can stick a la

Screen out directly, this code is for your reference, can not directly implement your function

CodePudding user response:

When I drag doesn't work, the attribute set the tree?
  • Related