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.

Ok, the :source is your friend (should be named :target :)); it will give you the Morph (whose model model is the ListModel instance).

        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 ].

This code does not integrate the fact that transfer may be a window (try to drag and drop a window on list1 and you'll see :))

Thierry
--
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

Reply via email to