Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Drag Drop Items in ListView


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 6 - Last Post: Sep 16, 2017 10:08 AM Last Post By: Patrick Premartin
Colin Kemp

Posts: 3
Registered: 10/18/99
Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 11, 2017 4:59 PM
Using Delphi Tokyo on Windows 10 - creators edition.

I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.

I have seen videos where this has been accomplished but these videos have only shown the end result and not the techniques. I have googled and read articles on similar but different concepts. However, I cannot find any suitable articles on Drop&Drag for FireMonkey TListView.

I have had no issues with a sibling VCL application on Windows 10 as the parameters in VCL for both the OnDragDrop and OnDragOver are more easily understood.

I think, that what I want to achieve is very straight forward but I just can't see it. Please could someone give me clue as to how to get Drag and Drop working on a ListView in a FireMonkey application?

regards and thanks

SeaCay
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 11, 2017 5:55 PM   in response to: Colin Kemp in response to: Colin Kemp
I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.

I have seen videos where this has been accomplished but these videos have only shown the end result and not the techniques.

Which videos were they?

I seem to recall that user scrolling needs to be turned off to allow the user to "drag" the items.

This is something I'm going to need to implement very soon.

--
Dave Nottage [TeamB]
Find hints tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Colin Kemp

Posts: 3
Registered: 10/18/99
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 12:08 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.

I have seen videos where this has been accomplished but these videos have only shown the end result and not the techniques.

Which videos were they?

I seem to recall that user scrolling needs to be turned off to allow the user to "drag" the items.

This is something I'm going to need to implement very soon.

--
Dave Nottage [TeamB]
Find hints tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com

Hello Dave,

Thanks for your reply.

I re-looked up the videos again and I was wrong, they do not use a FMX TListView, either they are running VCL TListView or they are not Delphi examples.

I tried to change the index value of a TListViewItem which was successful. In my test I changed the entry at Item index 4 to a 3 but the TListView did not change the order of the Items. I repeated the test and in every instance I could change the Index value but repositioning never took place.

Thanks again.

regards

SeaCay
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 9:23 AM   in response to: Colin Kemp in response to: Colin Kemp
Am 12.07.2017 um 09:08 schrieb Colin Kemp:
Dave Nottage wrote:
I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.

I have seen videos where this has been accomplished but these videos have only shown the end result and not the techniques.

Which videos were they?

I seem to recall that user scrolling needs to be turned off to allow the user to "drag" the items.

This is something I'm going to need to implement very soon.

--
Dave Nottage [TeamB]
Find hints tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com

Hello Dave,

Thanks for your reply.

I re-looked up the videos again and I was wrong, they do not use a FMX TListView, either they are running VCL TListView or they are not Delphi examples.

I tried to change the index value of a TListViewItem which was successful. In my test I changed the entry at Item index 4 to a 3 but the TListView did not change the order of the Items. I repeated the test and in every instance I could change the Index value but repositioning never took place.

Thanks again.

regards

SeaCay

Hello,

can't you just extract the TListViewItem at the place where it is being
dragged from, remember the index of the new place it shall be inserted
(adjusted by one because of the dragging) and then insert it there?

Greetings

Markus
Alastair Breingan

Posts: 7
Registered: 1/11/14
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2017 10:04 PM   in response to: Colin Kemp in response to: Colin Kemp
Colin Kemp wrote:
Using Delphi Tokyo on Windows 10 - creators edition.

I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.
Colin,
You are not the only one. I was whinging about this 3 years back (https://forums.embarcadero.com/thread.jspa?messageID=666898&#666898) and there is still no obvious answer. Its quite disgraceful that something which is a normal part of other programing toolkits is this difficult.

While I am on the rant, the whole implementation of this control is cumbersome. Try and implement an immediate swipe to delete (without showing the delete button) for example.

I keep hoping that someone more competent than i will nut this out.

Cheers
Al
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 14, 2017 9:37 AM   in response to: Alastair Breingan in response to: Alastair Breingan
Am 14.09.2017 um 07:04 schrieb Alastair Breingan:
Colin Kemp wrote:
Using Delphi Tokyo on Windows 10 - creators edition.

I am trying to create a FireMonkey app that allows users to re-order items in a TListView but after nearly one week of working on this issue, I admit that I am having difficulties.
Colin,
You are not the only one. I was whinging about this 3 years back (https://forums.embarcadero.com/thread.jspa?messageID=666898&#666898) and there is still no obvious answer. Its quite disgraceful that something which is a normal part of other programing toolkits is this difficult.

While I am on the rant, the whole implementation of this control is cumbersome. Try and implement an immediate swipe to delete (without showing the delete button) for example.

I keep hoping that someone more competent than i will nut this out.

Cheers
Al

Hello,

is this reported in quality.embarcadero.com?
If not please do so.

Greetings

Markus
Patrick Premartin

Posts: 4
Registered: 5/5/99
Re: Drag Drop Items in ListView  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 16, 2017 10:08 AM   in response to: Colin Kemp in response to: Colin Kemp
Hi

I had a similar problem on a project.

We didn't used a TListview but a TVertScrollBox where we created our "items".

We use drag&drog to reorder items. The Position.Y property of items is used to know their "index".

The problem is still the scroll of the component. We solved it by using a "button" on items for the reorder process.

If it can help you, I can give a sample code.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02