Solved

Drag & Drop between ListViews

Posted on 1998-08-15
2
247 Views
Last Modified: 2012-05-04
How can I make a "Drag & Drop" between two ListViews?
I have a component that handles all other drag and drops such as: from the desktop, from explorer or any other file manager. However it doesn't work with another ListView.
0
Comment
Question by:jonassondaniel
  • 2
2 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1362160
Hi jonassondaniel,

Have you got D2, or D3? Because in D2 there is a bug, sometimes it gives access violation... bug is fixed in D3.

This are the barebones I guess :

Use properties as eg. DropTarget for getting it finished
procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
 If (Sender as TListView) = listview1 then Accept := true
  else accept := false
end;

procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (sender as TListview)=Listview1 then begin
  // do your drop stuff here.

 end;
end;

Regards, Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1362161
oops, has to be :

procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
 Accept := ((Source as TListView) = listview2);
end;

procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (sender as TListview) and ((source as TlistView)=listview2) then begin
  // do your drop stuff here.
 end;

And now I'm gone.

Zif.
end;

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Title # Comments Views Activity
Delphi: how to implement a User Shortcut mapper? 1 118
Delphi 2 69
How to define IfThen functions in one common unit? 4 60
FMX and jaudiotracker playing memory stream 29 85
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 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