Solved

Drag & Drop between ListViews

Posted on 1998-08-15
2
241 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

15 Experts available now in Live!

Get 1:1 Help Now