B4J Question Drag and Drop From a listview to delete causes jump to the top of the form

MrKim

Well-Known Member
Licensed User
Longtime User
2/22/20 - EDIT: Replaced the .ZIP with one that runs without edit and eliminated the dragdrop on list items for clarity.

I have a number of Horizontal ListViews on a ScrollPane. The ListViews contain TextArea controls which have been set up for drag and drop, sometimes the drag and drop involves deleting the item from the ListView. The problem is, when you delete using drag and drop the ScrollPane Jumps to the top. I can get back to where I was by saving and setting .VPosition on the ScrollPane but it flickers badly - very unprofessional.

I don't know if this is a bug or if I am doing something wrong.

I have included a project which illustrates the problem. It is a quick hack. I have tried several ways to delete the item after the DragDrop is complete but none seem to work.
If you select an item in any of the lists and then click the "Delete (X)" box associated with that listview it works fine.
If you select an item in the list and drag it to the "Delete (X)" box it works but jumps back to the top of the ScrollPane. You have to actually scroll down to one of the lists that is off the form when it opens to actually see the problem.

Thanks for any help.

You can see in the video. Delete by click works, Delete by DragDrop Jumps back to the top of the Scrollpane.

 

Attachments

  • SkSchedule-TEST2.zip
    9.7 KB · Views: 176
Last edited:

stevel05

Expert
Licensed User
Longtime User
The demo doesn't run as there is an image missing, I added one but can't see what is causing the scroll pane to scroll after the drop. I think that's the key, but have run out of time today. The Drag and drop knows nothing about the scroll pane, so shouldn't be causing it directly.

One thing that I noticed and may play a part is that you enable all the delete areas as drop targets from the start. It may help to just enable the relevant target when an item is selected (Mouse pressed on it)

Or in fact you could just have the delete Icon as a single drop target.
 
Last edited:
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
The demo doesn't run as there is an image missing, I added one but can't see what is causing the scroll pane to scroll after the drop. I think that's the key, but have run out of time today. The Drag and drop knows nothing about the scroll pane, so shouldn't be causing it directly.

One thing that I noticed and may play a part is that you enable all the delete areas as drop targets from the start. It may help to just enable the relevant target when an item is selected (Mouse pressed on it)

Or in fact you could just have the delete Icon as a single drop target.

Interesting, I thought the .zip would include the image. The demo program is just to show the problem, the actual program works differently. I yanked all that code out for clarity. What is actually happening in the program is items are being dragdropped from one location in the list to another or from one list to another. All of which means deleting the item from its old location.
 
Upvote 0
Top