Drag and drop to reorder items in a single list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Drag and drop to reorder items in a single list

Jakob Reschke
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



DragDrop in single list.1.cs (3K) Download Attachment
DragDrop in single list - all.1.cs (5K) Download Attachment
DragDropInSingleList.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Drag and drop to reorder items in a single list

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


On 2018-08-14T14:50+02:00 Jakob Reschke <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: Drag and drop to reorder items in a single list

David T. Lewis
The changes work as advertised, and it seems like a good thing to
include in trunk. I cannot really say if there would be side effects,
but it is a small number of changed methods and I see nothing bad
happening so far. I'll keep it in my image.

Dave

On Sun, Nov 24, 2019 at 03:50:42PM +0100, Jakob Reschke wrote:

> 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 <[hidden email]> 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
> >

>


Reply | Threaded
Open this post in threaded view
|

Re: Drag and drop to reorder items in a single list

marcel.taeumel
Hi Jakob,

I just merged your fix into Trunk. Thanks! :-)

Morphic-mt.1595
ToolBuilder-Morphic-mt.251

(#handlesMouseOverDragging: could stay as is. Your example works fine.)

Best,
Marcel

Am 25.11.2019 14:52:15 schrieb David T. Lewis <[hidden email]>:

The changes work as advertised, and it seems like a good thing to
include in trunk. I cannot really say if there would be side effects,
but it is a small number of changed methods and I see nothing bad
happening so far. I'll keep it in my image.

Dave

On Sun, Nov 24, 2019 at 03:50:42PM +0100, Jakob Reschke wrote:
> 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 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
> >

>