Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drag and Drop in a List Box

Posted on 1997-06-04
3
Medium Priority
?
181 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 120 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

597 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