[squeak-dev] Drag and drop to reorder items in a single list

Jakob Reschke forums.jakob at resfarm.de
Tue Aug 14 12:50:24 UTC 2018


Hello everyone,

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
in again.

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:

    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. ;-)

Best regards,
Jakob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DragDrop in single list.1.cs
Type: application/octet-stream
Size: 2826 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180814/d66ce340/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DragDrop in single list - all.1.cs
Type: application/octet-stream
Size: 4312 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180814/d66ce340/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DragDropInSingleList.st
Type: application/octet-stream
Size: 2106 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180814/d66ce340/attachment-0002.obj>


More information about the Squeak-dev mailing list