Solved

TreeView Component

Posted on 1998-12-16
1
304 Views
Last Modified: 2009-07-29
I am trying to drag a TTreeNode from one TTreeView component to another using the onDragDrop event. I have set the DragMode to dmAutomatic for both components but at run time when I select a node, it seems to picking up the TTreeView component itself rather than the selected node.

So, as soonas I began dragging, the cursor changes to DragNoDrop preventing the onDragDrop event from occuring.

Have, I missed some vital property setting? I am using the standard code provided in the help for the OnDragDrop event, but I can't get the event to go off.

Lee Berry
0
Comment
Question by:leeberry2
1 Comment
 
LVL 3

Accepted Solution

by:
williams2 earned 100 total points
ID: 1351341
When you set your Drag mthod to dmAutomatic, you'll have to provide some extra code to make the control accept the drag. This is done by this example:

procedure TForm1.TreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
  Accept:= True;
end;


You will ofcourse have to to this on both TreeViews, but then it will work allright.

Regards,
Williams

BTW: If you are trying to use drag and drop with files, this will need special handling.. then use the components on www.melander.dk, they provide all the functions you'll need for that.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question