?
Solved

Drag & Drop between ListViews

Posted on 1998-08-15
2
Medium Priority
?
252 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
[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
  • 2
2 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 150 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 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