Solved

TreeView Component

Posted on 1998-12-16
1
301 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now