Re: Drag and drop items between list views
Posted by
MartinW on
Apr 02, 2014; 6:44pm
URL: https://forum.world.st/Drag-and-drop-items-between-list-views-tp4752285p4752399.html
First of all thank you for taking the time to explain all this to me! I already learned a lot about working with the spec widgets..
I still have a problem. The first version with the hardcoded collections did obviously change the original collections (that's the desired behaviour).
Goubier Thierry wrote
list1 acceptDropBlock:
[ :transfer :event :source :receiver :index |
transfer passenger do:
[:e |
collection1 insert: e first before: index.
collection2 remove: e first].
list1 items: collection1.
list2 items: collection2 ].
The last version though, did change the items in the list views, but not the original collections.
Goubier Thierry wrote
list1
acceptDropBlock: [ :transfer :event :source :receiver :index |
| c1 c2 l1 l2 |
l1 := source model model.
c1 := l1 listItems.
l2 := transfer source model model.
c2 := l2 listItems.
transfer passenger
do: [ :e |
c1 insert: e first before: index.
c2 remove: e first ].
l1 items: c1.
l2 items: c2 ].