Solved

TreeView Component

Posted on 1998-12-16
1
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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