Hi

Hi,

I have a problem getting the data from the source node in a virtual treeview OLE dragNdrop operation - between processes.

I have a VCL form with a TVirtualStringTree and a TMemo - and the objective is to be able to drag one node to another, and on the drop take some of the source nodes data and manipulate the target nodes data.

Within the same application no issues, but when doing this between processes - I do not seem to able to get data from the DataObject as I would expect. I do not want to add or insert nodes in target tree - just have access to both my source and my target nodes.

An example of one of my tries for the DragDrop event:

var
Data: PString;
Node: PVirtualNode;
begin
if Source<>nil then // within same process
begin
Data := TVirtualStringTree(Source).GetNodeData(TVirtualStringTree(Source).FocusedNode);
Memo1.Lines.Add('Source data: '+ Data^);
end
else
begin // between applications
Node := Sender.AddChild(nil); // temp node
Sender.ProcessDrop(DataObject, Node, Effect, amNoWhere);
// How to get the "FocusedNode" data from the "source"?
// Would have expected that protected ProcessOLEData(Source, DataObject, TargetNode, Mode, False)
// would give me something to work with.
Data := Sender.GetNodeData(Node);
Memo1.Lines.Add('Ext. source data:'+ Data^);
Sender.DeleteNode(Node); // clean up
end;
Data := Sender.GetNodeData(Sender.DropTargetNode);
Memo1.Lines.Add('Target data:'+ Data^);
end;

I started getting desperate when starting to use a temp node :D

The rest of the code is just a basic VirtualStringTree example with 10 nodes. Thanks in advance.

Comments

Post a Comment