Solved

Drag and Drop in a List Box

Posted on 1997-06-04
3
178 Views
Last Modified: 2010-04-06
I am looking for an example how to drag items within a list box
0
Comment
Question by:HarisIV
[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
3 Comments
 

Expert Comment

by:richweed
ID: 1336803
Are you working in delphi 2 or 1?

Can you give more details of what you want to do?

Cheers
Richard
0
 

Author Comment

by:HarisIV
ID: 1336804
I am working in Delphi 2 and I want to be able to drag an item for a position in the list and move it in another position in thelist.
0
 

Accepted Solution

by:
richweed earned 60 total points
ID: 1336805
Haris

Here goes, not the most elegant, but it works.

in the OnMouseDown event for the listbox add the following:

lastpos := listbox1.itemindex;

in the OnMouseUp event add:

listbox1.items.move(lastpos,listbox1.itemindex)

Also, add a global variable for the form:

var form1 : TForm;
    lastpos : integer;

This should do it, you can also change the cursor while dragging if you want to (I'll send info if you want to)

Cheers
Richard
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
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…

707 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