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

Jakob Reschke forums.jakob at resfarm.de
Sun Nov 24 14:50:42 UTC 2019


Is anyone interested in reviewing this? I still have it in my image, making
Morphic dirty, hampering Monticello backports in that package.

The attachments are still here:
http://forum.world.st/Drag-and-drop-to-reorder-items-in-a-single-list-td5082943.html

On 2018-08-14T14:50+02:00 Jakob Reschke <forums.jakob at resfarm.de> wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191124/2f81ad99/attachment.html>


More information about the Squeak-dev mailing list