Le 02/04/2014 17:40, MartinW a écrit :
Thank you. This is a step forward. The thing is i can't hardcode the collections. In the end product i don't have two but seven lists, so i must be able to detect in the acceptDropBlock which is the receiving collection/list.
I'll try to redo a halt in there to see if I can get the target inside the event, and, from the target, be able to get back to the list then :) Thierry
Goubier Thierry wrote
Ok, look at that code:
| collection1 collection2 list1 list2 | collection1 := #(1 2 3 4 5) asOrderedCollection. collection2 := #($a $b $c $d $e) asOrderedCollection. list1 := ListModel new. list1 items: collection1. list1 dragEnabled: true. list1 dropEnabled: true. 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 ]. list1 openWithSpec. list2 := ListModel new. list2 items: collection2. list2 dragEnabled: true. list2 dropEnabled: true. list2 acceptDropBlock: [ :transfer :event :source :receiver :index | self halt ]. ^ list2 openWithSpec
Now you can drag and drop from list2 to list1, and I think the code is good for drag and drop of multiple items.
-- View this message in context: http://forum.world.st/Drag-and-drop-items-between-list-views-tp4752285p47523... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95