tl;dr: the current PluggableTextMorph/Plus does not support the
reordering of items in a single list via drag and drop. Attached you
find a change set that fixes this, but it might also break in other
places. Thus, I kindly ask for a review.
Today I found myself implementing a ToolBuilder-built list in which
the items should be reorderable via drag and drop. Unfortunately, the
current implementation of PluggableTextMorph/Plus does not allow this:
you first have to drag the item out of the list before you can drop it
Seems like the list morph needs the mouse focus to be able to accept
the drop. However, the current implementation explicitly releases the
focus from the list upon grabbing the item.
Then I changed the PluggableTextMorphPlus to not drop the focus, but
keep it, when starting to drag an item. Now the focus would not even
be released anymore when the item was indeed dragged out of a list if
that list itself does not accept any drops (such as the method list in
the system browser: it does not accept drops, but the methods can be
dragged from it to the message categories list). So I have changed
further methods to make the list morphs always handle dragging events,
even if they are not interested in drops.
But I do not know what else that might have broken. So, please have a
look at the attached change sets. The one without "all" in the file
name contains only the actual changes. The one with "all" also
contains other relevant (unchanged) methods that I touched during my
investigation. Eventually, I would like to put this or a revised
edition of it in the inbox because list reordering via drag and drop
should not be impossible.
The third file contains a simple Model subclass with a list whose
items should be reorderable via drag and drop, so you do not have to
write it yourself. Grab a sample instance and open it with the
ToolBuilder open: DragDropInSingleList new.
In case I simply got it wrong and there is no need to change Morphic
lists to achieve what I want, please tell me how to do it right. ;-)