Drag N Drop ListView or ScrollView

Flosch

Member
Licensed User
Longtime User
Hi,

I want to create a List where the user can rearrange the order of the list over a long click event and drop the entry to the right position.

For example:

I have the following list:

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

The user will press long on Item 3 and then move it to Position 1 with his finger so the new order will be:

Item 3
Item 1
Item 2
Item 4
Item 5
Item 6


So I already figured out that it is easier to rearrange a ScrollView than a List View. But I couldn't find an example of the Drag N Drop event. Is there an example with something similar?

Thanks for your help!
 

Flosch

Member
Licensed User
Longtime User
Thanks for the quick reply.
Is there any Drag N Drop example around?
I’m a beginner with b4a – so any help would be good.

Thanks
 
Upvote 0

Flosch

Member
Licensed User
Longtime User
Thanks Earl - I have seen this thread already. I think I can handle the Scroll View.
But I have no idea how to handle a Drag and Drop event - so I'm pretty sure I need some help there ;-)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I'm afraid that you can't do it.
Because for a DragNDrop function you need the Touch event.
But with a ScrollView or with a ListView the Touch event is already consumed and can't be used anymore.
Perhaps in the future with an overlaying Panel if it's Touch Event could be treated like the KeyPress event.

Best regards.
 
Upvote 0

Flosch

Member
Licensed User
Longtime User
Thanks Klaus - so I will stop my experiments and will go to the next task:

A list of all Audio Files sorted by artist / track name or album!
If anybody has some information or tips how to realise this – don’t hesitate to let me know. I’m already playing with the ContentChooser but I only get all Audio Files - nothing sorted.
 
Upvote 0

Djembefola

Active Member
Licensed User
Longtime User
A list of all Audio Files sorted by artist / track name or album!
If anybody has some information or tips how to realise this

You need to read the id3v2 tags of the mp3 files. This can be done with the Random access file library.
 
Upvote 0
Top