I want to move tree nodes (db records) in TcxDBTreeList by dragging, is there a property on this component for this option ?
+1
A:
Check the OnBeginDragNode event. That looks to be the best place for what you want to do.
yozey
2010-05-05 13:11:36
@yozey: onbegindragnode event solved my problem.
dnn
2010-05-05 21:17:02
Glad I could help :-).
yozey
2010-05-06 00:59:40
+2
A:
to enable drag-drop records on TcxDbTreeList
write the codes below to events;
onBeginDragNode event
Allow:= True;
onDragOver event
Accept:=True;
set the cxDbTreeList's DragMode Property
DragMode:=dmAutomatic;
dnn
2010-05-05 21:23:22
A:
I found that I actually had to move the nodes myself:
procedure TForm1.cxDBTreeList1MoveTo(...);
var i:integer;
begin
for i := 0 to Nodes.Count - 1 do
begin
// move the node in the tree
TcxTreeListNode(Nodes[i]).MoveTo(AttachNode, AttachMode);
// change the database to match
UpdateParentForNode(NodeID, NewParentID, SortSpecifier);
end;
Done := True;
end;
It makes a certain amount of sense in the DBTreeView - the grid doesn't really have a good way to know exactly how you want to change the moved row(s). There's probably a sort order to be modified as well as the parent id.
moz
2010-07-02 04:40:21