Rearrange rows in a TableListBox via drag and drop


#1

Doesn’t the TableListBox support drag and drop to rearrange rows? Similar to TreeView, where a line gets drawn between two items before the selected item(s) get dropped.

The visualization of the target location isn’t very important, but the basic functionality of rearranging rows with the mouse would be great to have. E.g. for playlists, items to process, …

Do I have to implement this myself by inherit from TableListBox and DragAndDropTarget? Or is it already available in TableListBox/TableListBoxModel and I just couldn’t figure out how?


#2

I’ve been trying to fight with this myself via ListBox and TreeView for the past few days. TreeView is obviously the easiest way, but I’ve also seen several forum posts from 2010-2012 where people were trying to figure out how to do Drag-And-Drop to Reorder Rows for the ListBox class. Most of the replies were “you gotta figure it out yourself”.

What’s the reasoning behind ListBox not supporting Drag-To-Reorder by default?
Why doesn’t the JuceDemo show how to implement this?
Is TreeView the proper tool for having a Drag-To-Reorder GUI element in a project?

relevant threads with no, or non-clear (“figure it out yourself”) answers:

https://forum.juce.com/t/reorder-listbox-items-by-drag-and-drop/12970
https://forum.juce.com/t/tablelistboxmodel-drag-and-drop-per-cell/14084
https://forum.juce.com/t/tablelistbox-rows-as-draganddrop-targets/6227
https://forum.juce.com/t/what-a-drag/348/17
https://forum.juce.com/t/listbox-drag-and-drop/5135
https://forum.juce.com/t/treeview-draganddrop-a-couple-questions/28440