Manually sort list with drag&drop or up/down-arrows

Marc Assenmacher's icon

Hello,

I am running into a problem that seemed so easy at first but drives me nuts now.

I need to manually sort a list during a live session either with drag&drop (preferred) or choosing an index and sorting with up/down-arrows (second choice).

Example: Moving the 4...

1 2 3 4 5 6 7 8 >> starting point

1 2 3 5 4 67 8 >> move the 4 to the right 1 time

1 2 3 5 6 4 7 8 >> move the 4 to the right 1 time

1 2 3 5 6 7 4 8 >> move the 4 to the right 1 time

1 4 2 3 5 6 7 8 >> move the 4 to the left 5 tims

My Approach was using zl.swap and the incdec object, but my patch makes a mess. Everytime I switch directions, the old target makes another swap, making my patch useless.

Here is my patch:

Move-List-Item.maxpat
Max Patch

Anyone did this before or has a hint?

Marc Assenmacher's icon

Somehow I missed this forum thread until now:

For everyone interested: You can find drag and drop reordering of lists there. Amazing work!

Roman Thilenius's icon

while i am a fan of zl, this kind of job can be done best using coll´s insert, delete, merge, sort and swap messages, and combinations of them.