Solved

TreeView Component

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

16 Experts available now in Live!

Get 1:1 Help Now